jquery Programming Glossary: it's
Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go handlers should be in the body to avoid errors although it's not fool proof . One more reason to not use Google hosted jQuery..
HTML-encoding in JavaScript/jQuery http://stackoverflow.com/questions/1219860/html-encoding-in-javascript-jquery function htmlEncode value create a in memory div set it's inner text which jQuery automatically encodes then grab the..
jQuery Mobile: document ready vs page events http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events the data object This should be added to the documentation it's not listed currently . The pageload event could therefore be..
How do I “think in AngularJS” if I have a jQuery background? http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background '.main menu' .dropdownMenu When we just look at the view it's not immediately obvious that there is any functionality here... seem anything from silly to superfluous to hipster. But it's not. From a broad perspective DI means that you can declare.. This is really part of section 3 on architecture but it's so important that I'm putting it as its own top level section...
Can I use multiple versions of jQuery on the same page? http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page older version of jQuery installed. While this may work if it's at least a fairly recent version our code does rely on some.. check for the presence of jQuery detect the version and if it's too old then somehow load the most recent version just to use.. jquery iframe version share improve this question Yes it's doable due to jQuery's noconflict mode. http blog.nemikor.com..
Add table row in jQuery http://stackoverflow.com/questions/171027/add-table-row-in-jquery can include anything within the after method as long as it's valid HTML including multiple rows as per the example above...
jQuery AJAX cross domain http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain . 09 01 12 corrected the statement The echo might be wrong it's been a while since I done php. In any case you need to output.. 'jsonString' notice the quotes. jQuery will pass it's own callback name so you need to get that from the GET params...
jQuery: Return data after ajax call success [duplicate] http://stackoverflow.com/questions/5316697/jquery-return-data-after-ajax-call-success call but that would freeze up the browser while it's waiting for the response. You can pass in a callback function..
Resetting a multi-stage form with jQuery http://stackoverflow.com/questions/680241/resetting-a-multi-stage-form-with-jquery see that it has pretty much turned into a big mess. I feel it's about time I come back to it and make my answer truly correct..
Auto-size dynamic text to fill fixed size container http://stackoverflow.com/questions/687998/auto-size-dynamic-text-to-fill-fixed-size-container So If the div is 400px x 300px. If someone enters ABC then it's really big font. If they enter a paragraph then it would be.. My Text Here span div This is my first jquery plugin so it's probably not as good as it should be. Pointers are certainly..
Can somebody explain jQuery queue to me? [closed] http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me which flags that the queue is currently being run. It's the default The fx queue is used by .animate and all functions..
What's the difference in the :not() selector between jQuery and CSS? http://stackoverflow.com/questions/10711730/whats-the-difference-in-the-not-selector-between-jquery-and-css minuscule bonus you'll definitely salivate over. It's worth noting that the Selectors 4 spec enhances the not selector..
Use jQuery to hide a DIV when the user clicks outside of it http://stackoverflow.com/questions/1403615/use-jquery-to-hide-a-div-when-the-user-clicks-outside-of-it Had the same problem came up with this easy solution. It's even working recursive document .mouseup function e var container..
change type of input field with jQuery http://stackoverflow.com/questions/1544317/change-type-of-input-field-with-jquery jquery html input share improve this question It's very likely this action is prevented as part of the browser's..
jQuery get specific option tag text http://stackoverflow.com/questions/196684/jquery-get-specific-option-tag-text down menu jquery selectors share improve this question It's looking for an element with id list which has a property value..
jQueryUI: how can I custom-format the Autocomplete plug-in results? http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results css class used for the formatting of the completed part. It's an inline style. This means if you had multiple autocompletes..
Assign click handlers in for loop http://stackoverflow.com/questions/4091765/assign-click-handlers-in-for-loop jquery jquery selectors share improve this question It's a common mistake to create closures in loops in Javascript...
jQuery Call to WebService returns “No Transport” error http://stackoverflow.com/questions/5241088/jquery-call-to-webservice-returns-no-transport-error WebMethod public string HelloWorld return Hello World It's stock standard with no alterations to the class decorators... XMLHttpRequest textStatus errorThrown alert errorThrown It's a post action because later on I need to post data to it. When..
Browser Memory Usage Comparison: inline onClick vs. using JQuery .bind() http://stackoverflow.com/questions/5303471/browser-memory-usage-comparison-inline-onclick-vs-using-jquery-bind currently have I suggest you to use beforeSelectRow event. It's advantage is that if the user will click on one from your custom..
Sending multipart/formdata with jQuery.ajax http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax to a serverside PHP script using jQuery's ajax function. It's possible to get the File List with '#fileinput' .attr 'files'..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr unhelpful and unnecessary. The property is what you need. It's not obvious what the correct way to check or uncheck the checkbox..
Graph visualization code in JavaScript? http://stackoverflow.com/questions/7034/graph-visualization-code-in-javascript what you may be looking for http www.graphdracula.net It's JavaScript with directed graph layouting SVG and you can even..
jQuery Data vs Attr? http://stackoverflow.com/questions/7261619/jquery-data-vs-attr 'fooBarBaz' works '#bar' .data 'foo bar baz' does not work It's for this reason I suggest avoiding the hyphenated key in javascript...
$(document).ready equivalent without jQuery http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery loaded. javascript jquery share improve this question It's much more complicated than just window.onload jQuery Source..
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on jquery live jquery 1.7 share improve this question It's pretty clear in the docs why you wouldn't want to use live...
jQuery .live() vs .on() method for adding a click event after loading dynamic html http://stackoverflow.com/questions/8752321/jquery-live-vs-on-method-for-adding-a-click-event-after-loading-dynamic-ht the event handling is delegated to a parent object . It's done this way because you can attach the event to the #parent..
jQuery event for images loaded http://stackoverflow.com/questions/910727/jquery-event-for-images-loaded doStuff But will this break if an image fails to load It's critically important for the method to be called and at the..
JQuery: Selecting Text in an Element (akin to highlighting with your mouse) http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse selection.setBaseAndExtent text 0 text 1 EDIT 9 28 11 It's been a while since this answer was updated and I've learned..
Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go This should be in your page's head and any jQuery ready event handlers should be in the body to avoid errors although it's not fool proof . One more reason to not use Google hosted jQuery is that in some countries Google's domain name is banned...
HTML-encoding in JavaScript/jQuery http://stackoverflow.com/questions/1219860/html-encoding-in-javascript-jquery html encode share improve this question I use these functions function htmlEncode value create a in memory div set it's inner text which jQuery automatically encodes then grab the encoded contents back out. The div never exists on the page...
jQuery Mobile: document ready vs page events http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events pageload event passes the new page as the page property of the data object This should be added to the documentation it's not listed currently . The pageload event could therefore be used to access the loaded page. In few words this is happening..
How do I “think in AngularJS” if I have a jQuery background? http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background application logic we would activate it with something like '.main menu' .dropdownMenu When we just look at the view it's not immediately obvious that there is any functionality here. For small applications that's fine. But for non trivial applications.. you're a client side guy coming from jQuery this concept can seem anything from silly to superfluous to hipster. But it's not. From a broad perspective DI means that you can declare components very freely and then from any other component just.. Speaking of testing... 4. Test driven development always This is really part of section 3 on architecture but it's so important that I'm putting it as its own top level section. Out of all of the many jQuery plugins you've seen used or..
Can I use multiple versions of jQuery on the same page? http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page The problem is that some customers may already have an older version of jQuery installed. While this may work if it's at least a fairly recent version our code does rely on some recently introduced functionality in the jQuery library so there.. any code on the customer's page Ideally maybe we could check for the presence of jQuery detect the version and if it's too old then somehow load the most recent version just to use for our code. I had the idea of loading jQuery in an iframe.. iframe s . Thanks in advance for any insight javascript jquery iframe version share improve this question Yes it's doable due to jQuery's noconflict mode. http blog.nemikor.com 2009 10 03 using multiple versions of jquery load jQuery 1.1.3..
Add table row in jQuery http://stackoverflow.com/questions/171027/add-table-row-in-jquery instead '#myTable tr last' .after ' tr ... tr tr ... tr ' You can include anything within the after method as long as it's valid HTML including multiple rows as per the example above. Update Revisiting this answer following recent activity with..
jQuery AJAX cross domain http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain arr 'name' response echo _GET 'callback' . .json_encode arr . 09 01 12 corrected the statement The echo might be wrong it's been a while since I done php. In any case you need to output callbackName 'jsonString' notice the quotes. jQuery will pass.. a while since I done php. In any case you need to output callbackName 'jsonString' notice the quotes. jQuery will pass it's own callback name so you need to get that from the GET params. And as Stefan Kendall posted .getJSON is a shorthand method..
jQuery: Return data after ajax call success [duplicate] http://stackoverflow.com/questions/5316697/jquery-return-data-after-ajax-call-success would be to make a synchronous call instead of an asynchronous call but that would freeze up the browser while it's waiting for the response. You can pass in a callback function that handles the result function testAjax handleData .ajax..
Resetting a multi-stage form with jQuery http://stackoverflow.com/questions/680241/resetting-a-multi-stage-form-with-jquery after I originally answered this question I come back to see that it has pretty much turned into a big mess. I feel it's about time I come back to it and make my answer truly correct since it is the most upvoted accepted. For the record Titi's..
Auto-size dynamic text to fill fixed size container http://stackoverflow.com/questions/687998/auto-size-dynamic-text-to-fill-fixed-size-container so that the text fills the box as much as possible. So If the div is 400px x 300px. If someone enters ABC then it's really big font. If they enter a paragraph then it would be a tiny font. I'd probably want to start with a maximum font..
Can somebody explain jQuery queue to me? [closed] http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me push into the first location of the array the string inprogress which flags that the queue is currently being run. It's the default The fx queue is used by .animate and all functions that call it by default. NOTE If you are using a custom queue..
What's the difference in the :not() selector between jQuery and CSS? http://stackoverflow.com/questions/10711730/whats-the-difference-in-the-not-selector-between-jquery-and-css not extension . If you're anal about performance that's a positively minuscule bonus you'll definitely salivate over. It's worth noting that the Selectors 4 spec enhances the not selector to allow a comma separated list of compound selectors...
Use jQuery to hide a DIV when the user clicks outside of it http://stackoverflow.com/questions/1403615/use-jquery-to-hide-a-div-when-the-user-clicks-outside-of-it jquery div hide styling share improve this question Had the same problem came up with this easy solution. It's even working recursive document .mouseup function e var container YOUR CONTAINER SELECTOR if container.is e.target if the..
change type of input field with jQuery http://stackoverflow.com/questions/1544317/change-type-of-input-field-with-jquery value Prihlásiť class input submit div li ol form javascript jquery html input share improve this question It's very likely this action is prevented as part of the browser's security model. Edit indeed testing right now in Safari I..
jQuery get specific option tag text http://stackoverflow.com/questions/196684/jquery-get-specific-option-tag-text '2' .text But it is not working. javascript jquery drop down menu jquery selectors share improve this question It's looking for an element with id list which has a property value equal to 2. What you want is the option child of the list..
jQueryUI: how can I custom-format the Autocomplete plug-in results? http://stackoverflow.com/questions/2435964/jqueryui-how-can-i-custom-format-the-autocomplete-plug-in-results That regexp obj ought to be re used for all items. there's no css class used for the formatting of the completed part. It's an inline style. This means if you had multiple autocompletes on the same page they'd all get the same treatment. A css..
Assign click handlers in for loop http://stackoverflow.com/questions/4091765/assign-click-handlers-in-for-loop other click I get 'you clicked 20' . What am I doing wrong jquery jquery selectors share improve this question It's a common mistake to create closures in loops in Javascript. You need to have some sort of callback function like this function..
jQuery Call to WebService returns “No Transport” error http://stackoverflow.com/questions/5241088/jquery-call-to-webservice-returns-no-transport-error No Transport&rdquo error I have the following web service WebMethod public string HelloWorld return Hello World It's stock standard with no alterations to the class decorators. I have this jQuery method var webMethod http localhost 54473.. url webMethod success function msg alert msg.d error function XMLHttpRequest textStatus errorThrown alert errorThrown It's a post action because later on I need to post data to it. When I execute the jQuery I get a No transport error returned...
Browser Memory Usage Comparison: inline onClick vs. using JQuery .bind() http://stackoverflow.com/questions/5303471/browser-memory-usage-comparison-inline-onclick-vs-using-jquery-bind beforeSelectRow . To have mostly close behavior to what you currently have I suggest you to use beforeSelectRow event. It's advantage is that if the user will click on one from your custom buttons the row selection can stay unchanged. With the..
Sending multipart/formdata with jQuery.ajax http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax formdata with jQuery.ajax I've got a problem sending a file to a serverside PHP script using jQuery's ajax function. It's possible to get the File List with '#fileinput' .attr 'files' but how is it possible to send this Data to the server The..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr of using the checked attribute for scripting a checkbox is unhelpful and unnecessary. The property is what you need. It's not obvious what the correct way to check or uncheck the checkbox is using the checked attribute The attribute value reflects..
Graph visualization code in JavaScript? http://stackoverflow.com/questions/7034/graph-visualization-code-in-javascript layout share improve this question I've just put together what you may be looking for http www.graphdracula.net It's JavaScript with directed graph layouting SVG and you can even drag the nodes around. Still needs some tweaking but is totally..
jQuery Data vs Attr? http://stackoverflow.com/questions/7261619/jquery-data-vs-attr key set '#bar' .data .fooBarBaz works '#bar' .data 'fooBarBaz' works '#bar' .data 'foo bar baz' does not work It's for this reason I suggest avoiding the hyphenated key in javascript. For HTML keep using the hyphenated form. HTML attributes..
$(document).ready equivalent without jQuery http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery window.onload fires after all images frames etc have been loaded. javascript jquery share improve this question It's much more complicated than just window.onload jQuery Source function bindReady if readyBound return readyBound true Mozilla..
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on and what the benefits are of using this new method. jquery jquery live jquery 1.7 share improve this question It's pretty clear in the docs why you wouldn't want to use live. Also as mentioned by Felix .on is a more streamline way of attaching..
jQuery .live() vs .on() method for adding a click event after loading dynamic html http://stackoverflow.com/questions/8752321/jquery-live-vs-on-method-for-adding-a-click-event-after-loading-dynamic-ht fire your click handler. This is called delegated event handling the event handling is delegated to a parent object . It's done this way because you can attach the event to the #parent object even when the #child object does not exist yet but..
jQuery event for images loaded http://stackoverflow.com/questions/910727/jquery-event-for-images-loaded var imageCount 0 'img' .load function if imageCount imageTotal doStuff But will this break if an image fails to load It's critically important for the method to be called and at the right time. jquery dom share improve this question Per..
JQuery: Selecting Text in an Element (akin to highlighting with your mouse) http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse range else if .browser.safari var selection window.getSelection selection.setBaseAndExtent text 0 text 1 EDIT 9 28 11 It's been a while since this answer was updated and I've learned a lot as a developer since I asked and answered this question...
|