jquery Programming Glossary: since
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 but fail in CSS Shouldn't not work identically in both since jQuery borrows from the CSS3 standard or is there something.. but fail in CSS Shouldn't not work identically in both since jQuery borrows from the CSS3 standard or is there something..
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 to throw a bunch of jQuery. In other words they think since I can't do DOM manipulation in the controller I'll take that..
change type of input field with jQuery http://stackoverflow.com/questions/1544317/change-type-of-input-field-with-jquery specific We can't allow the type property to be changed since it causes problems in IE if name type jQuery.nodeName elem input..
jQuery animate backgroundColor http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor best compression in this case needing only 2317 bytes and since it is so small here it is function d d.each backgroundColor..
jQuery $(document).ready and UpdatePanels? http://stackoverflow.com/questions/256195/jquery-document-ready-and-updatepanels of the documentation before you use this approach however since it may or may not meet your needs. There are a lot of jQuery..
apply !important CSS style using jQuery http://stackoverflow.com/questions/2655925/apply-important-css-style-using-jquery style inline so using .width and the like does not work since it gets overridden by my external important style. Also the.. changes I made to the width in jQuery would be unaffected since they would be added to the style attribute. Compatibility For..
jQuery document.createElement equivalent? http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent 0 .addClass text Update I thought I'd update this post since it still gets quite a bit of traffic. In the comments below..
Is there a jQuery DOM change listener? http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener event across browsers. It has been supported in Chrome since 1.0. #someDiv .bind DOMSubtreeModified function alert tree changed..
jQuery AJAX cross domain http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain 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'..
Download File Using Javascript/jQuery http://stackoverflow.com/questions/3749231/download-file-using-javascript-jquery .click But I cannot use window.href method as solution since it replaces the current page contents with the file you're trying..
Where is the best place to put <script> tags in HTML markup? http://stackoverflow.com/questions/436411/where-is-the-best-place-to-put-script-tags-in-html-markup placing at the beginning of the body section is bad too since the JavaScript will have to be parsed before the page is rendered..
Where do you include the jQuery library from? Google JSAPI? CDN? http://stackoverflow.com/questions/547384/where-do-you-include-the-jquery-library-from-google-jsapi-cdn by Google API servers. I didn't go with the jsapi method since I don't leverage any other Google API's however if that ever..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr you need to take a step back and learn a little about it since jQuery is no longer trying so hard to shield you from this stuff... and worked flawlessly in every major scriptable browser since 1995 if document.getElementById cb .checked ... The property..
Resetting a multi-stage form with jQuery http://stackoverflow.com/questions/680241/resetting-a-multi-stage-form-with-jquery time I come back to it and make my answer truly correct since it is the most upvoted accepted. For the record Titi's answer..
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on events. Use of the .live method is no longer recommended since later versions of jQuery offer better methods that do not have..
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 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.. answer was updated and I've learned a lot as a developer since I asked and answered this question. It has also gotten a lot..
jQuery ajax (jsonp) ignores a timeout and doesn't fire the error event http://stackoverflow.com/questions/1002367/jquery-ajax-jsonp-ignores-a-timeout-and-doesnt-fire-the-error-event doesn't provide error handling or work with timeouts. Since .getJSON is just a wrapper around .ajax I decided to rewrite..
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 for the cloud in general. Edit This part added... Since Google suggests using google.load to load the ajax libraries..
jQuery Validate - require at least one field in a group to be filled http://stackoverflow.com/questions/1300994/jquery-validate-require-at-least-one-field-in-a-group-to-be-filled using jQuery's .data 2 Re run validation on each of them. Since the others are now flagged as being in the process they will..
jQuery & Prototype Conflict http://stackoverflow.com/questions/134572/jquery-prototype-conflict noConflict as alluded to above . However there's a catch. Since you're including a plugin you'll need to do the includes in..
Microsoft CDN for jQuery or Google CDN? http://stackoverflow.com/questions/1447184/microsoft-cdn-for-jquery-or-google-cdn Combined.js v 2.2.0.6190 Major.Minor.Iteration.Changeset Since part of our build process is combining and minifying all custom.. minified versions of these scripts depending on the build. Since Google doesn't host the jQuery validation package this can be..
Can I use jQuery with Node.js? http://stackoverflow.com/questions/1801160/can-i-use-jquery-with-node-js javascript jquery node.js share improve this question Since November 4th 2010 you can simply do this npm install jquery..
jQuery animate backgroundColor http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor Safari and crashes when the transitions are too fast. Since a minified version isn't supplied you might like test various..
jQuery: sending credentials with cross-domain posts? http://stackoverflow.com/questions/2054316/jquery-sending-credentials-with-cross-domain-posts Functionality is supposed to be broken in jQuery 1.5. Since jQuery 1.5.1 you should use xhrFields param. .ajaxSetup type..
jQuery event handlers always execute in order they were bound - any way around this? http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-t from an array to something else for example. Disclaimer Since anything is possible here's your solution but I would still..
jQuery UI Autocomplete widget search configuration http://stackoverflow.com/questions/2382497/jquery-ui-autocomplete-widget-search-configuration a way to do this using the jQuery UI widget specifically. Since I'm already using jQuery UI in my project I'm planning to stick..
Escaping HTML strings with jQuery http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery jquery string escaping share improve this question Since you're using jQuery you can just set the element's text property..
How can I override the OnBeforeUnload dialog and replace it with my own? http://stackoverflow.com/questions/276660/how-can-i-override-the-onbeforeunload-dialog-and-replace-it-with-my-own parse the return value as a string unless it is null . Since false is parsed as a string the dialogue box will fire which..
Is there a jQuery DOM change listener? http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener have a script execute when the contents of a DIV change. Since the scripts are separate content script in chrome extension.. answer is now deprecated. See the answer by apsillers . Since this is for a Chrome extension you might as well use the standard..
jQuery Ajax POST example with php http://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php prevent default posting of form event.preventDefault Note Since jQuery 1.8 .success .error and .complete are deprecated in favor..
jQuery .find() doesn't return data in IE but does in Firefox and Chrome http://stackoverflow.com/questions/562283/jquery-find-doesnt-return-data-in-ie-but-does-in-firefox-and-chrome was scraped out of a forum and modified to suit my needs. Since jQuery is cross platform I figured I wouldn't have to deal with..
Keyboard shortcuts with jQuery http://stackoverflow.com/questions/593602/keyboard-shortcuts-with-jquery jquery keyboard shortcuts share improve this question Since this question was originally asked John Resig the primary author..
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on .live ... is not valid and does not work as expected. Since all .live events are attached at the document element events..
Does jQuery.on() work for elements that are added after the event handler is created? http://stackoverflow.com/questions/9814298/does-jquery-on-work-for-elements-that-are-added-after-the-event-handler-is-cre by attaching all event handlers to the document object. Since the document object is an ancestor of every object in the document..
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 jsFiddle preview Why does the selector work in jQuery but fail in CSS Shouldn't not work identically in both since jQuery borrows from the CSS3 standard or is there something I'm missing Is there a workaround for this if I really want.. improve this question Why does the selector work in jQuery but fail in CSS Shouldn't not work identically in both since jQuery borrows from the CSS3 standard or is there something I'm missing Perhaps it should but it turns out that it doesn't..
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 of developers new to AngularJS using directives as the place to throw a bunch of jQuery. In other words they think since I can't do DOM manipulation in the controller I'll take that code put it in a directive . While that certainly is much better..
change type of input field with jQuery http://stackoverflow.com/questions/1544317/change-type-of-input-field-with-jquery be a bug or part of their security model but jQuery isn't specific We can't allow the type property to be changed since it causes problems in IE if name type jQuery.nodeName elem input elem.parentNode throw type property can't be changed Edit..
jQuery animate backgroundColor http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor compressors and make your own min version. YUI gets the best compression in this case needing only 2317 bytes and since it is so small here it is function d d.each backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor..
jQuery $(document).ready and UpdatePanels? http://stackoverflow.com/questions/256195/jquery-document-ready-and-updatepanels re subscribing to DOM elements on every update. Read all of the documentation before you use this approach however since it may or may not meet your needs. There are a lot of jQuery plugins that would be unreasonable to refactor to use .delegate..
apply !important CSS style using jQuery http://stackoverflow.com/questions/2655925/apply-important-css-style-using-jquery important style that I am trying to override with an important style inline so using .width and the like does not work since it gets overridden by my external important style. Also the value that will override the previous value is computed so I.. in my CSS to avoid conflicts with other theme CSS but any changes I made to the width in jQuery would be unaffected since they would be added to the style attribute. Compatibility For setting with the priority using the setProperty function http..
jQuery document.createElement equivalent? http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent ' div div ' .hide .append ' table table ' .attr cellSpacing 0 .addClass text Update I thought I'd update this post since it still gets quite a bit of traffic. In the comments below there's some discussion about div vs div div vs document.createElement..
Is there a jQuery DOM change listener? http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener DOM event DOMSubtreeModified . See the support for this event across browsers. It has been supported in Chrome since 1.0. #someDiv .bind DOMSubtreeModified function alert tree changed See a working example here . share improve this answer..
jQuery AJAX cross domain http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain 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 it's own callback..
Download File Using Javascript/jQuery http://stackoverflow.com/questions/3749231/download-file-using-javascript-jquery need to start download a file when i manually calls 'a#someID' .click But I cannot use window.href method as solution since it replaces the current page contents with the file you're trying to download. Instead I want to open the download in new..
Where is the best place to put <script> tags in HTML markup? http://stackoverflow.com/questions/436411/where-is-the-best-place-to-put-script-tags-in-html-markup you are not supposed to place these in the head section but placing at the beginning of the body section is bad too since the JavaScript will have to be parsed before the page is rendered completely or something like that . This seems to leave..
Where do you include the jQuery library from? Google JSAPI? CDN? http://stackoverflow.com/questions/547384/where-do-you-include-the-jquery-library-from-google-jsapi-cdn question Without a doubt I choose to have JQuery served by Google API servers. I didn't go with the jsapi method since I don't leverage any other Google API's however if that ever changed then I would consider it... First The Google api servers..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr by this whole business about properties and attributes you need to take a step back and learn a little about it since jQuery is no longer trying so hard to shield you from this stuff. For the authoritative but somewhat dry word on the subject.. to do with the checked Boolean property which has existed and worked flawlessly in every major scriptable browser since 1995 if document.getElementById cb .checked ... The property also makes checking or unchecking the checkbox trivial document.getElementById..
Resetting a multi-stage form with jQuery http://stackoverflow.com/questions/680241/resetting-a-multi-stage-form-with-jquery 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 answer is wrong as it is not what the original poster asked for it..
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on mentioned by Felix .on is a more streamline way of attaching events. Use of the .live method is no longer recommended since later versions of jQuery offer better methods that do not have its drawbacks. In particular the following issues arise with..
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 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. It has also gotten.. 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. It has also gotten a lot more attention than I thought it would. I want to provide a..
jQuery ajax (jsonp) ignores a timeout and doesn't fire the error event http://stackoverflow.com/questions/1002367/jquery-ajax-jsonp-ignores-a-timeout-and-doesnt-fire-the-error-event photo's from Flickr. The reason for doing this is that .getJSON doesn't provide error handling or work with timeouts. Since .getJSON is just a wrapper around .ajax I decided to rewrite the thing and surprise surprise it works flawlessly. Now the..
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 to have the Google version cached. I'm thinking about fallbacks for the cloud in general. Edit This part added... Since Google suggests using google.load to load the ajax libraries and it performs a callback when done I'm wondering if that's..
jQuery Validate - require at least one field in a group to be filled http://stackoverflow.com/questions/1300994/jquery-validate-require-at-least-one-field-in-a-group-to-be-filled 1 Flag all matching elements as 'currently being validated' using jQuery's .data 2 Re run validation on each of them. Since the others are now flagged as being in the process they will skip this section and therefore won't turn around and validate..
jQuery & Prototype Conflict http://stackoverflow.com/questions/134572/jquery-prototype-conflict of Scriptaculous. If that does not work you will need to use noConflict as alluded to above . However there's a catch. Since you're including a plugin you'll need to do the includes in a specific order for example script src jquery.js script script..
Microsoft CDN for jQuery or Google CDN? http://stackoverflow.com/questions/1447184/microsoft-cdn-for-jquery-or-google-cdn removing all UpdatePanels jQuery.Validate.min.js Our server Combined.js v 2.2.0.6190 Major.Minor.Iteration.Changeset Since part of our build process is combining and minifying all custom javascript we do this via a custom script manager that includes.. script manager that includes the release or debug non minified versions of these scripts depending on the build. Since Google doesn't host the jQuery validation package this can be a down side. MVC is including using this in their 2.0 release..
Can I use jQuery with Node.js? http://stackoverflow.com/questions/1801160/can-i-use-jquery-with-node-js selectors DOM manipulation on the server side using Node.js javascript jquery node.js share improve this question Since November 4th 2010 you can simply do this npm install jquery This package internally uses the modules jsdom and xmlhttprequest..
jQuery animate backgroundColor http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor of the plugin and not some buggy old thing which doesn't handle Safari and crashes when the transitions are too fast. Since a minified version isn't supplied you might like test various compressors and make your own min version. YUI gets the best..
jQuery: sending credentials with cross-domain posts? http://stackoverflow.com/questions/2054316/jquery-sending-credentials-with-cross-domain-posts it jquery firefox cross domain share improve this question Functionality is supposed to be broken in jQuery 1.5. Since jQuery 1.5.1 you should use xhrFields param. .ajaxSetup type POST data dataType 'json' xhrFields withCredentials true crossDomain..
jQuery event handlers always execute in order they were bound - any way around this? http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-t if the underlying representation of attached events changes from an array to something else for example. Disclaimer Since anything is possible here's your solution but I would still err on the side of refactoring your existing code as just trying..
jQuery UI Autocomplete widget search configuration http://stackoverflow.com/questions/2382497/jquery-ui-autocomplete-widget-search-configuration last name like it is in Gmail. Note I'm trying to figure out a way to do this using the jQuery UI widget specifically. Since I'm already using jQuery UI in my project I'm planning to stick with it and try not adding additional libraries to my web..
Escaping HTML strings with jQuery http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery the framework at the moment to accomplish this. javascript jquery string escaping share improve this question Since you're using jQuery you can just set the element's text property before div class someClass text div var someHtmlString..
How can I override the OnBeforeUnload dialog and replace it with my own? http://stackoverflow.com/questions/276660/how-can-i-override-the-onbeforeunload-dialog-and-replace-it-with-my-own value of the handler as window.event.returnValue . It will then parse the return value as a string unless it is null . Since false is parsed as a string the dialogue box will fire which will then pass an appropriate true false . The result is there..
Is there a jQuery DOM change listener? http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener there a jQuery DOM change listener Essentially I want to have a script execute when the contents of a DIV change. Since the scripts are separate content script in chrome extension webpage script I need a way simply observe changes in DOM state... chrome extension share improve this question Edit This answer is now deprecated. See the answer by apsillers . Since this is for a Chrome extension you might as well use the standard DOM event DOMSubtreeModified . See the support for this..
jQuery Ajax POST example with php http://stackoverflow.com/questions/5004233/jquery-ajax-post-example-with-php function reenable the inputs inputs.prop disabled false prevent default posting of form event.preventDefault Note Since jQuery 1.8 .success .error and .complete are deprecated in favor of .done .fail and .always. PHP i.e. form.php you can access..
jQuery .find() doesn't return data in IE but does in Firefox and Chrome http://stackoverflow.com/questions/562283/jquery-find-doesnt-return-data-in-ie-but-does-in-firefox-and-chrome I hope I haven't just done something stupid. That code above was scraped out of a forum and modified to suit my needs. Since jQuery is cross platform I figured I wouldn't have to deal with this mess. Edit I've found that if I load the page in Visual..
Keyboard shortcuts with jQuery http://stackoverflow.com/questions/593602/keyboard-shortcuts-with-jquery is the character map for all the letters BTW javascript jquery keyboard shortcuts share improve this question Since this question was originally asked John Resig the primary author of jQuery has forked and improved the js hotkeys project...
What's the difference between jQuery .live() and .on() http://stackoverflow.com/questions/8042576/whats-the-difference-between-jquery-live-and-on methods is not supported. For example a .find .offsite .external .live ... is not valid and does not work as expected. Since all .live events are attached at the document element events take the longest and slowest possible path before they are..
Does jQuery.on() work for elements that are added after the event handler is created? http://stackoverflow.com/questions/9814298/does-jquery-on-work-for-elements-that-are-added-after-the-event-handler-is-cre event handler for it. The now deprecated .live method worked by attaching all event handlers to the document object. Since the document object is an ancestor of every object in the document they got delegated event handling that way. So in the..
|