Search Results

Search found 23820 results on 953 pages for 'jquery ui autocomplete'.

Page 81/953 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • Changing an HTML Form's Target with jQuery

    - by Rick Strahl
    This is a question that comes up quite frequently: I have a form with several submit or link buttons and one or more of the buttons needs to open a new Window. How do I get several buttons to all post to the right window? If you're building ASP.NET forms you probably know that by default the Web Forms engine sends button clicks back to the server as a POST operation. A server form has a <form> tag which expands to this: <form method="post" action="default.aspx" id="form1"> Now you CAN change the target of the form and point it to a different window or frame, but the problem with that is that it still affects ALL submissions of the current form. If you multiple buttons/links and they need to go to different target windows/frames you can't do it easily through the <form runat="server"> tag. Although this discussion uses ASP.NET WebForms as an example, realistically this is a general HTML problem although likely more common in WebForms due to the single form metaphor it uses. In ASP.NET MVC for example you'd have more options by breaking out each button into separate forms with its own distinct target tag. However, even with that option it's not always possible to break up forms - for example if multiple targets are required but all targets require the same form data to the be posted. A common scenario here is that you might have a button (or link) that you click where you still want some server code to fire but at the end of the request you actually want to display the content in a new window. A common operation where this happens is report generation: You click a button and the server generates a report say in PDF format and you then want to display the PDF result in a new window without killing the content in the current window. Assuming you have other buttons on the same Page that need to post to base window how do you get the button click to go to a new window? Can't  you just use a LinkButton or other Link Control? At first glance you might think an easy way to do this is to use an ASP.NET LinkButton to do this - after all a LinkButton creates a hyper link that CAN accept a target and it also posts back to the server, right? However, there's no Target property, although you can set the target HTML attribute easily enough. Code like this looks reasonable: <asp:LinkButton runat="server" ID="btnNewTarget" Text="New Target" target="_blank" OnClick="bnNewTarget_Click" /> But if you try this you'll find that it doesn't work. Why? Because ASP.NET creates postbacks with JavaScript code that operates on the current window/frame: <a id="btnNewTarget" target="_blank" href="javascript:__doPostBack(&#39;btnNewTarget&#39;,&#39;&#39;)">New Target</a> What happens with a target tag is that before the JavaScript actually executes a new window is opened and the focus shifts to the new window. The new window of course is empty and has no __doPostBack() function nor access to the old document. So when you click the link a new window opens but the window remains blank without content - no server postback actually occurs. Natch that idea. Setting the Form Target for a Button Control or LinkButton So, in order to send Postback link controls and buttons to another window/frame, both require that the target of the form gets changed dynamically when the button or link is clicked. Luckily this is rather easy to do however using a little bit of script code and jQuery. Imagine you have two buttons like this that should go to another window: <asp:LinkButton runat="server" ID="btnNewTarget" Text="New Target" OnClick="ClickHandler" /> <asp:Button runat="server" ID="btnButtonNewTarget" Text="New Target Button" OnClick="ClickHandler" /> ClickHandler in this case is any routine that generates the output you want to display in the new window. Generally this output will not come from the current page markup but is generated externally - like a PDF report or some report generated by another application component or tool. The output generally will be either generated by hand or something that was generated to disk to be displayed with Response.Redirect() or Response.TransmitFile() etc. Here's the dummy handler that just generates some HTML by hand and displays it: protected void ClickHandler(object sender, EventArgs e) { // Perform some operation that generates HTML or Redirects somewhere else Response.Write("Some custom output would be generated here (PDF, non-Page HTML etc.)"); // Make sure this response doesn't display the page content // Call Response.End() or Response.Redirect() Response.End(); } To route this oh so sophisticated output to an alternate window for both the LinkButton and Button Controls, you can use the following simple script code: <script type="text/javascript"> $("#btnButtonNewTarget,#btnNewTarget").click(function () { $("form").attr("target", "_blank"); }); </script> So why does this work where the target attribute did not? The difference here is that the script fires BEFORE the target is changed to the new window. When you put a target attribute on a link or form the target is changed as the very first thing before the link actually executes. IOW, the link literally executes in the new window when it's done this way. By attaching a click handler, though we're not navigating yet so all the operations the script code performs (ie. __doPostBack()) and the collection of Form variables to post to the server all occurs in the current page. By changing the target from within script code the target change fires as part of the form submission process which means it runs in the correct context of the current page. IOW - the input for the POST is from the current page, but the output is routed to a new window/frame. Just what we want in this scenario. Voila you can dynamically route output to the appropriate window.© Rick Strahl, West Wind Technologies, 2005-2011Posted in ASP.NET  HTML  jQuery  

    Read the article

  • Is my JS/Jquery methodology good?

    - by absentx
    I always struggle with which of the stack sites is best to post "questions of theory" like this, but I think programmers is the best, if not, as usual a mod will move it etc... I am seeking critique on what has become my normal methodology of writing javascript. I have become heavily reliant on the Jquery library, but I think this has helped me learn the native language better also. Anyways, please critique the following style of JS coding...buried are a lot of questions of scope, if you could point out the strengths and weaknesses of this style I would appreciate it. var critique ={ start: function(){ globalness = 'GLOBAL-GLOBAL'; //available to all critique's methods var notglobalness = 'LOCAL-LOCAL';// only available to critiques start method //am I using the "method" teminology properly here?? $('#stuff').on('click','a.closer-target',function(){ $target = $(this); if($target.hasClass('active')){ $target.removeClass('active'); } else{ $target.addClass('active'); critique.madness($target); } }) console.log(notglobalness+': at least I am useful at home'); console.log('note here that: '+notglobalness+' is no longer available after this point, lets continue on:'); critique.madness(notglobalness); }, madness: function($e){ // do a bunch of awesomeness with $e //but continue to keep it seperate because you think its best to keep things isolated. //send to the next function when complete here console.log('here is globalness, which is still available from the start method of critique!! ' + globalness); console.log('lets see if the globalness carries on to a new var object!!'); console.log('the locally isolated variable of NOTGLOBALNESS is available here because it was passed to this method, lets show it:'+$e); carryOn.start(); } } //end critique var carryOn={ start: function(){ console.log('any chance critique.globalness will work here??? lets see: ' +globalness); console.log('it absolutely does'); } } $(document).ready(critique.start);

    Read the article

  • Jquery calculator

    - by Nemanja
    I want to make calculator for summation. I have this jquery code: <script type="text/javascript"> $(document).ready(function() { $("#calculate").click(function() { if ($("#input").val() != '' && $("#input").val() != undefined) { $("#result").html("Result is: " + parseInt($("#input").val()) * 30 ); } else { $("#result").html("Please enter some value"); } }); }); </script> <div id="calculator"> <br /> <input type="text" style="left:20px;" id="input" /> <div id="result"></div> <input type="button" id="calculate" value="calculate" style="left:20px;" /> </div> I want something like this: I write number 5, then input + from keyboard and write another value. Then to click on summation button and to get value. Can anyone help me with this? Thank you very much!

    Read the article

  • jquery selector for elements beside one another? [migrated]

    - by PaulHanak
    this SHOULD be simple, but I have been through the Jquery Selector help for about an hour now and nothing seems to be working. Help! I am basically trying to pull the text (an address) of a SPAN after a user clicks on the link next to it. Please note though, I will have about 10 on a page, so I cannot set a static address. It must be pulled when the user clicks. The html code: <a href="3" class="clicky">Click to Show Map</a> <span style="display: none" class="theaddy">123 Fake Street, Somewhere Else, 12341</span> So really, my question is, how do I grab the text from .theaddy when a user clicks on .clicky? As I said, I cannot use var propertyaddy = $(.theaddy).text(); because there are 10 of these addy's on the same page. I need some sort of "THIS" Next To kinda thing. I also tossed around the idea of placing the SPAN inside the A, but my efforts on that weren't working either. Thank you in advance for any help!

    Read the article

  • Edit value of n number of <td> using jquery or javascript [on hold]

    - by Yousaf
    Hello Guys I am trying to edit the value of n number of td but i am onlt able to edit 1 value how can edit n number of tds i dont know how many rows could be in table here is my current code i want to do it dynamically HTML <input type="text" name="editValue" id="editValue" value="" /> <br> <table id="testing"> <tr> <td id="tdid">Value1</td> <td><a href="#" id="button" >Edit</a></td> </tr> <tr> <td >Value2</td> <td><a href="#">Edit</a></td> </tr> </table> Jquery $("#button").on('click', function(){ var r = $("#tdid").text(); $("#editValue").val(r); }); Here is working example http://jsfiddle.net/M5Gkb/6/

    Read the article

  • How to float a <div> echoed in the footer over a <div> located elsewhere (PHP/jQuery/HTML/CSS)

    - by PlasmaFlux
    Hello All! I'm embarking on a major project, but am stuck on a tiny issue at the very start. I'll try to be as concise as possible. I have a PHP script that will be echoing into the footer of the page (the last stuff before a bunch of s containing visible buttons and s containing hidden dialog boxes. The plan is to have the buttons float in the upper-right corner of corresponding s in the main content area of the page. i.e. - button-1 echoed into the footer will float in the corner of content-box-1, and will be tied to the hidden 'dialog-1'. I'll be using jQuery and jQuery UI Dialog throughout the page(s). I'm not sure if that's particularly relevant to this question, but thought it worth mentioning just in case. So my question, put simply, is how do I echo a Button 1 into the footer with PHP, but have it float in the upper-right corner (with maybe 5px margin) of Content 1 is full of content? A picture says a thousand words: As shown above, I want the little blue gear button things in the corner of content pieces, locked and loaded with hidden s containing dialog boxes. Again, the catch is that all buttons and hidden divs will be the very last items echoed into the page footer. I've found plenty of info on how to float divs on top of divs, but all the examples I saw showed the s in close proximity to each other in the page source; not with a hundred lines of source code between the two s I'm not sure if the solution is pure CSS, pure jQuery/jQueryUI or a combination of the two. Any advice will be much appreciated. Thanks!

    Read the article

  • Does anyone know why jquery dialog is showing stale content on ajax update ?

    - by oo
    I have a series of links and when i click on a link i want to show a dialog with detail information. This detail is returned from an jquery ajax request. I am using the following code below to show a partial result through ajax onto a jquery dialog. Here is the jquery code: $(document).ready(function() { $('a.click').live('click', function() { var url = '/Tracker/Info?id=' + $(this).attr("id"); var dialogOpts = { modal: true, bgiframe: true, autoOpen: false, height: 600, width: 450, overlay: { opacity: 0.7, background: "black" }, draggable: true, resizeable: true, open: function() { //display correct dialog content $("#dialogDiv").load(url); } }; $("#dialogDiv").dialog(dialogOpts); //end dialog $("#dialogDiv").dialog("open"); }); }); Here is my controller action code: public ActionResult Info(int id) { return PartialView("LabelPartialView", _Repository.GetItem(id)); } Here is the issue: When i click this the first time (lets say i send id = 1234) it works fine. When i click on another item (lets say i send id = 4567) it shows the content from 1234 still. Which i click this second item again (again its 4567), then it will show the content from 4567. Does anyone know why it might not be refreshed the first time? Is this a timing issue?

    Read the article

  • notice in Jquery Autocomplete

    - by Katherine
    what is the problem if i got this notice saying: Notice: Undefined index: 8 in C:\xampp\htdocs\projects\wesm\intranet\plugins\survey_manager\index.php on line 80 i'm using the jquery autocomplete.. here is some of my code for javascript in which the error occurred: <script type='text/javascript'> var intranetUsers = ["<?php echo $content[0].' ", "'; $num = 1; while($num != $getInranetUserCount['num']){ echo $content[$num].'" , "'; $num = $num + 1; } echo $content[$getInranetUserCount['num']]; ?>"]; </script> I've already use that code in some module and it works I don't know why it doesn't work this time.

    Read the article

  • jQuery: event that tracks click in browser autocomplete

    - by Fernando
    I have a keyup event on an input. This event works fine for auto complete when you select a value and press enter. But it doesn't work when you click at an auto complete value. Is there an event that i can use in such case? I already tried the change one but it doesn't work. Thanks! Edit: Maybe i was not clear but i am referring to the autocomplete feature that browsers have. I am not trying to build my own. Example: I have the following event: $('.product').keyup(searchByProduct); When user clicks at this input the old values that he already typed shows up ( it's the browser that does this ). If he clicks on one of the values, the function searchByProduct is not called. Which event do i have to register to track this click ( and that the input content has changed )?

    Read the article

  • jquery - turning "autocomplete" to off for all forms (even ones not loaded yet)

    - by matthewsteiner
    So, I've got this code: $(document).ready(function(){ $('form').attr('autocomplete', 'off'); }); It works great for all forms already existing. The problem is, some forms of mine are in pop ups loaded throught ajax. This won't apply to them since they're "loaded" later. I know there's a live() function - but that's only for attaching events. What's a good way to apply this to all forms? Thanks.

    Read the article

  • Is my JavaScript/jQuery methodology good? [migrated]

    - by absentx
    I am seeking critique on what has become my normal methodology of writing JavaScript code. I have become heavily reliant on the jQuery library, but I think this has helped me learn the native language better also. Anyway, please critique the following style of JavaScript coding... Buried are a lot of questions of scope; if you could point out the strengths and weaknesses of this style I would appreciate it. var critique ={ start: function(){ globalness = 'GLOBAL-GLOBAL'; //Available to all critique's methods var notglobalness = 'LOCAL-LOCAL'; // Only available to critiques start method //Am I using the "method" teminology properly here?? $('#stuff').on('click','a.closer-target',function(){ $target = $(this); if($target.hasClass('active')){ $target.removeClass('active'); } else{ $target.addClass('active'); critique.madness($target); } }) console.log(notglobalness+': at least I am useful at home'); console.log('note here that: '+notglobalness+' is no longer available after this point, lets continue on:'); critique.madness(notglobalness); }, madness: function($e){ //Do a bunch of awesomeness with $e, //but continue to keep it seperate because you think its best to keep things isolated. //Send to the next function when complete here console.log('Here is globalness, which is still available from the start method of critique!! ' + globalness); console.log('Let us see if the globalness carries on to a new var object!!'); console.log('The locally isolated variable of NOTGLOBALNESS is available here, because it was passed to this method. Let us show it:'+$e); carryOn.start(); } } //end critique var carryOn={ start: function(){ console.log('any chance critique.globalness will work here??? lets see: ' +globalness); console.log('it absolutely does'); } } $(document).ready(critique.start); (I always struggle with which of the Stack Exchange sites is best to post "questions of theory" like this, but I think Programmers is the best, if not, as usual a mod will move it, etc...)

    Read the article

  • WPF UI Automation - AutomationElement.FindFirst fails when there are lots of elements

    - by Orion Edwards
    We've got some automated UI tests for our WPF app (.NET 4); these test use the UI Automation API's. We call AutomationElement.FindFirst to find a target element, and then interact with it. Example (pseudocode): var nameEquals = new PropertyCondition(AutomationElement.NameProperty, "OurAppWindow"); var appWindow = DesktopWindow.FindFirst(TreeScope.Children, nameEquals); // this succeeds var idEquals = new PropertyCondition(AutomationElement.AutomationIdProperty, "ControlId"); var someItem = appWindow.FindFirst(TreeScope.Descendants, idEquals); // this suceeds sometimes, and fails sometimes! The problem is, the appWindow.FindFirst will sometimes fail and return null, even when the element is present. I've written a helper function which walks the UI automation tree manually and prints it out, and the element with the correct ID is present in all cases. It seems to be related to how many other items are also being displayed in the window. If there are no other items then it always succeeds, but when there are many other complex UI elements being displayed alongside it, then the find fails. I can't find any documented element limit mentioned for any of the automation API's - is there some way around this? I'm thinking I might have to write my own implemententation of FindFirst which does the tree walk manually itself... As far as I can tell this should work, because my tree-printer utility function does exactly that, and it's ok, but it seems like this would be unnecessary and slow :-( Any help would be greatly appreciated

    Read the article

  • Pattern for UI configuration

    - by TERACytE
    I have a Win32 C++ program that validates user input and updates the UI with status information and options. Currently it is written like this: void ShowError() { SetIcon(kError); SetMessageString("There was an error"); HideButton(kButton1); HideButton(kButton2); ShowButton(kButton3); } void ShowSuccess() { SetIcon(kError); std::String statusText (GetStatusText()); SetMessageString(statusText); HideButton(kButton1); HideButton(kButton2); ShowButton(kButton3); } // plus several more methods to update the UI using similar mechanisms I do not likes this because it duplicates code and causes me to update several methods if something changes in the UI. I am wondering if there is a design pattern or best practice to remove the duplication and make the functionality easier to understand and update. I could consolidate the code inside a config function and pass in flags to enable/disable UI items, but I am not convinced this is the best approach. Any suggestions and ideas?

    Read the article

  • How can i change a jquery plugin's option value with my value?

    - by Pandiya Chendur
    I have just jquery pagination plugin to work... But what happens is when i click page number 2 i get the first page and when i click 3 i get second page and so on.... My initial page my current page value changes to 0 instead 1 this causes the problem... My plugin has this, jQuery.fn.pagination = function(maxentries, opts){ opts = jQuery.extend({ items_per_page:10, num_display_entries:10, current_page:0, num_edge_entries:0, link_to:"#", prev_text:"Prev", next_text:"Next", ellipse_text:"...", prev_show_always:true, next_show_always:true, callback:function(){return false;} },opts||{}); current_page is set to 0 ... I have modified the current page value in my jquery function but it doesn't seem to work.... <script type="text/javascript"> var itemsPerPage = 5; var maxNumberOfElementsHere = 17; $(document).ready(function() { getRecordspage(1, itemsPerPage); $(".pager").pagination(maxNumberOfElementsHere, { callback: getRecordspage, current_page: 1, // Look here i have changed this but it doesn't work... items_per_page: itemsPerPage, num_display_entries: 5, next_text: 'Next', prev_text: 'Prev', num_edge_entries: 1 }); }); </script>

    Read the article

  • Trying to use jquery ui in google chrome extension in the content level

    - by user135697
    The problem is that the scope of the content script is on the web page that your plugin is suppose to be used at. So the css background:url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) becomes url('http://webpageforplugin/images/ui-bg_inset-hard_100_fcfdfd_1x100.png') in order for this to work as far as i understood i need to have it to point to: url('chrome-extension://extensionId/images/ui-bg_inset-hard_100_fcfdfd_1x100.png') So i tried to haxorz the document.styleSheets var ss = document.styleSheets; for (var i=0; i<ss.length; i++) { var found=-1, x,i; var rules = ss[i].cssRules || ss[i].rules; for (var j=0; j<rules.length; j++) { if ('.ui-helper-hidden'==rules[j].selectorText){ found=i; break; } } if (found>-1){ for (var j=0; j<rules.length; j++) { if (x=rules[j].style.background){ if ((i=x.indexOf('url'))!=-1) rules[j].style.background = x.replace('http://page/images/','chrome-extension://extensionId/images/'); } } break; } }; I feel that i'm missing the obvious. That there must be an easier way. Even if i manage to change this how will i get the extension id to build the string. Btw this doesn't work, the icons are not properly fetched. (I hardcoded the extension id) Any ideas?

    Read the article

  • jquery ui dialog in asp.net mvc3 doesn't open on second time

    - by giri
    when i click the New Trade button in the form it opens jquery ui dialog. but, i have link button in the gridview when i click the link button it should open jquery ui dialog, it opens jquery ui dialog before clicking the new trade button. but, after clicking the new trade button, if i click link button in the gridview it invoke "ViewTradeDialog(id)" function, the dialog doesn't open, it shows error message "$vwdia.html(data).dialog is not a function". my code follows: @using (Html.BeginForm("NewTrade", "Trade", FormMethod.Post, new { id = "searchForm" })) { <div id="searchbtn"> <input id="btn_newtrade" type="submit" value="New Trade" /> </div> } jquery code <script type="text/javascript"> $(function () { var $loading = $('<img src="../../loading.gif" alt="loading">'); var $dialog = $('<div></div>').append($loading); $('#searchForm').submit(function (e) { var url = this.action; $.ajax({ autoOpen: false, url: url, success: function (data) { $dialog.html(data).dialog({ zIndex:1, width: 1400, height: 600, resizable: false, title: 'New Trade Details', modal: true, buttons: { "close": function () { $dialog.dialog('close'); }, "Add Trade": function () { $dialog.dialog('close'); $.ajax({ type: 'POST', url: url }); } } }); } }); return false; }); }); function ViewTradeDialog(id) { alert(id); var $vwdia = $('<div></div>'); var url = '/Trade/ViewTrades?tradeid=' + id; $.ajax({ url: url, success: function (data) { $vwdia.html(data).dialog({ width: 600, height: 600, resizable: false, title: 'View Trade Details', modal: false, buttons: { "close": function () { $vwdia.dialog('close'); } } }); } }); return false; }

    Read the article

  • HTML , Jquery Fisheye menu

    - by Thirumalai
    I have used the fisheye jquery "interface.js" I want to make make 3rd element with id="default" should be show default like mouse over effect , Please help me thaks in advance <div class="dock" id="dock1"> <div class="dock-container2"> <a class="dock-item2" href="#" ><span>E-Mail</span><img src="images/ui/img1.png" alt="home" width="40"/></a> <a class="dock-item2" href="#"><span>Contact</span><img src="images/ui/img2.png" alt="contact" width="50" /></a> <a class="dock-item2" href="#" id="default"><span>Car</span><img src="images/ui/img3.png" alt="portfolio" width="60"/></a> <a class="dock-item2" href="#"><span>Home</span><img src="images/ui/img4.png" alt="music" width="70" /></a> <a class="dock-item2" href="#"><span>Air Line</span><img src="images/ui/img5.png" alt="video" width="80" /></a> <a class="dock-item2" href="#"><span>Train</span><img src="images/ui/img6.png" alt="history" width="70"/></a> <a class="dock-item2" href="#"><span>Hotel</span><img src="images/ui/img7.png" alt="calendar" width="60"/></a> <a class="dock-item2" href="#"><span>Links</span><img src="images/ui/img8.png" alt="links" width="50"/></a> <a class="dock-item2" href="#"><span>Call Us</span><img src="images/ui/img9.png" alt="rss" width="40" /></a> </div> $(document).ready(function () { $('#dock1').Fisheye({ maxWidth: 60, items: 'a', itemsText: 'span', container: '.dock-container2', itemWidth: 40, proximity: 80, alignment: 'left', valign: 'top', halign: 'center' }); $("#pagecontent").slider(); });

    Read the article

  • Is it possible to run Modern UI Apps in Windows 7

    - by soandos
    It seems like a basic question, but is there a way to run Windows 8 (Modern Apps) in Windows 7 (without a VM, that seems like cheating)? My hunch is that it would be possible with some sort of hack, as the code is written in the same .Net languages as many other programs. The only issue would be intercepting the finger to corner gestures, but I am not sure how much is there really (is it just a location, or a special win API call). Is there software that can do this, or options that need to be changed to make this work?

    Read the article

  • jQuery fading in an element - not working exactly as i want it to...

    - by Nike
    Anybody see what's wrong? Doesn't seem to do anything. If i replace $(this, '.inner').stop(true, false).fadeIn(250); with $(.fadeInOnHover .inner').stop(true, false).fadeIn(250); then all the .inner elements on the page will fade in (which isn't really what i want, as i have ~10 of them). I know it's possible to achieve what i want to do, but i don't know how in this case. Thanks in advance :) <script type="text/javascript"> $(document).ready(function() { $('.fadeInOnHover .inner').css("display","none"); $('.fadeInOnHover').hover(function() { $(this, '.inner').stop(true, false).fadeIn(250); }).mouseout(function() { $(this, '.inner').stop(true, true).fadeOut(100); }); }); </script>

    Read the article

  • CascadingDropDown jQuery Plugin for ASP.NET MVC

    - by rajbk
    CascadingDropDown is a jQuery plugin that can be used by a select list to get automatic population using AJAX. A sample ASP.NET MVC project is attached at the bottom of this post.   Usage The code below shows two select lists : <select id="customerID" name="customerID"> <option value="ALFKI">Maria Anders</option> <option value="ANATR">Ana Trujillo</option> <option value="ANTON">Antonio Moreno</option> </select>   <select id="orderID" name="orderID"> </select> When a customer is selected in the first select list, the second list will auto populate itself with the following code: $("#orderID").CascadingDropDown("#customerID", '/Sales/AsyncOrders'); Internally, an AJAX post is made to ‘/Sales/AsyncOrders’ with the post body containing  customerID=[selectedCustomerID]. This executes the action AsyncOrders on the SalesController with signature AsyncOrders(string customerID).  The AsyncOrders method returns JSON which is then used to populate the select list. The JSON format expected is shown below : [{ "Text": "John", "Value": "10326" }, { "Text": "Jane", "Value": "10801" }] Details $(targetID).CascadingDropDown(sourceID, url, settings) targetID The ID of the select list that will auto populate.  sourceID The ID of the select list, which, on change, causes the targetID to auto populate. url The url to post to Options promptText Text for the first item in the select list Default : -- Select -- loadingText Optional text to display in the select list while it is being loaded. Default : Loading.. errorText Optional text to display if an error occurs while populating the list Default: Error loading data. postData Data you want posted to the url in place of the default Example : { postData : { customerID : $(‘#custID’), orderID : $(‘#orderID’) }} will cause customerID=ALFKI&orderID=2343 to be sent as the POST body. Default: A text string obtained by calling serialize on the sourceID onLoading (event) Raised before the list is populated. onLoaded (event) Raised after the list is populated, The code below shows how to “animate” the  select list after load. Example using custom options: $("#orderID").CascadingDropDown("#customerID", '/Sales/AsyncOrders', { promptText: '-- Pick an Order--', onLoading: function () { $(this).css("background-color", "#ff3"); }, onLoaded: function () { $(this).animate({ backgroundColor: '#ffffff' }, 300); } }); To return JSON from our action method, we use the Json ActionResult passing in an IEnumerable<SelectListItem>. public ActionResult AsyncOrders(string customerID) { var orders = repository.GetOrders(customerID).ToList().Select(a => new SelectListItem() { Text = a.OrderDate.HasValue ? a.OrderDate.Value.ToString("MM/dd/yyyy") : "[ No Date ]", Value = a.OrderID.ToString(), }); return Json(orders); } Sample Project using VS 2010 RTM NorthwindCascading.zip

    Read the article

  • jQuery - discrepency between classname and selectors

    - by Ciel
    I have the following code that I wrote, which I personally found to be pretty nice. It takes a <ul> and it drops down the contents when clicked. But I am having a disconnect here in comprehension, and one I had to do what I feel is a 'dirty hack' to solve. The problem is that I do not want the class `'sidebar-dropdown-open' to be so 'hardwired' in the plugin. However I discovered that there is a very stark difference between... $('.sidebar-dropdown-open') and 'sidebar-dropdown-open and even '.sidebar-dropdown-open. I 'solved' this problem by including two different 'parameters' in my plugin, but I was wondering if someone might give me some insight as to how I could perform this better, and why this was behaving this way. wiring (document load) $(document).ready(function () { $('[data-role="sidebar-dropdown"]').drawer({ open: 'sidebar-dropdown-open', css: '.sidebar-dropdown-open' }); }); html <ul> <li class=" dropdown" data-role="sidebar-dropdown"> <a href="pages/.." class="remote">Link Text</a> <ul class="sub-menu light sidebar-dropdown-menu"> <li><a class="remote" href="pages/...">Link Text</a></li> <li><a class="remote" href="pages/...">Link Text</a></li> <li><a class="remote" href="pages/...">Link Text</a></li> </ul> </li> </ul> javascript (function ($) { $.fn.drawer = function (options) { // Create some defaults, extending them with any options that were provided var settings = $.extend({ open: 'open', css: '.open' }, options); return this.each(function () { $(this).on('click', function (e) { // slide up all open dropdown menus $(settings.css).not($(this)).each(function () { $(this).removeClass(settings.open); // retrieve the appropriate menu item var $menu = $(this).children(".dropdown-menu, .sidebar-dropdown-menu"); // slide down the one clicked on. $menu.slideUp('fast'); $menu.removeClass('active'); }); // mark this menu as open $(this).addClass(settings.open); // retrieve the appropriate menu item var $menu = $(this).children(".dropdown-menu, .sidebar-dropdown-menu"); // slide down the one clicked on. $menu.slideDown(100); $menu.addClass('active'); e.preventDefault(); e.stopPropagation(); }).on("mouseleave", function () { $(this).children(".dropdown-menu").hide().delay(300); }); }) }; })(jQuery); I have tried using settings.open and demanding that it just be a className (.open), etc. - but that does not seem to work. It seems to get ignored by the removeClass function.

    Read the article

  • Jquery mobile and Google maps [on hold]

    - by Jack
    I have been trying to get my google maps to display within a page of a mobile app. The map will display for a second, and then disappear. I have read about a jquery bug, but i can't seem to find a way to get this code to work. any help would be greatly appreciated. <script> var geocoder; var currentLocation; var searchResults; var map; var directionsDisplay; var directionsService; function init(){ geocoder = new google.maps.Geocoder(); if (navigator.geolocation){ navigator.geolocation.watchPosition(showLocation, locationError); } else { alert("Geolocation not supported on this device"); return; } }//init function function showLocation(location){//start showlocation currentLocation = new google.maps.LatLng(location.coords.latitude, location.coords.longitude); $('#lat').attr("value", currentLocation.lat()); $('#lng').attr("value", currentLocation.lng()); geocoder = new google.maps.Geocoder(); geocoder.geocode({'latLng': currentLocation}, function(results, status){ if (status == google.maps.GeocoderStatus.OK){ if (results[0]){ var address = results[0].formatted_address; $('#loc').html(results[0].formatted_address); var info = "Latitude: " + location.coords.latitude + " Longitude: " + location.coords.longitude + "<br />"; info += "Location accurate within " + location.coords.accuracy + " meters <br /> Last Update: " + new Date(location.timestamp).toLocaleString(); $('#acc').html(info); $('#address').attr("value", results[0].formatted_address); }else{ alert('No results found'); }//end else //if(!map) initMap(); }else { $('#loc').html('Geocoder failed due to: ' + status); }//end else });//end of function if (!map) initMap(); }//end showlocation function function locationError(error){ switch(error.code) { case error.PERMISSION_DENIED: alert("Geolocation access denied or disabled. To enable geolocation on your iPhone, go to Settings > General> Location Services"); break; case error.POSITION_UNAVAILABLE: alert("Current location not available"); break; case error.TIMEOUT: alert("Timeout"); break; default: alert("unkown error"); break; }//endswitch }//endlocationerror function initMap(){ var mapOptions = { zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP, center: currentLocation };//var mapOptions map = new google.maps.Map(document.getElementById('mapDiv'), mapOptions); google.maps.event.trigger(map, 'resize'); var bounds = new google.maps.LatLngBounds(); bounds.extend(currentLocation); map.fitBounds(bounds); //new code //var center; //function calculateCenter(){ //center = map.getCenter(); //} //google.maps.even.addDomListener(map, 'idle', function(){ //calculateCenter(); //}); //google.maps.even.addListenerOnce(map, 'idle', function(){ //google.maps.even.trigger(map,'resize'); //}); //google.maps.event.addDomListener(window, 'resize', function() { //map.setCenter(center); //});//end new code }//end initMap() //------------------------------------------------------------------------------- $(document).on("pageinit", init);

    Read the article

  • jqGrid jQuery UI button wrapping in toolbar

    - by gurun8
    I have a jQuery UI Button that I'm placing in a jqGrid toolbar but the contents of the button are wrapping. I've tried to prevent the wrapping by using CSS white-space Property to no avail. Here's a snapshot of what's happening: Here are two code snippets of my attempt to fix the problem: $("#t_imageList").css("white-space", "nowrap").html('<button>Add</button>'); $("#t_imageList button").button({ icons: {primary: 'ui-icon-plus'}, text: true }); and/or $("#t_imageList button").css("white-space", "nowrap").button({ icons: {primary: 'ui-icon-plus'}, text: true }); Has someone experienced the same issue? If so, what was your solution?

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >