jquery Programming Glossary: things
jQuery $(this) vs this http://stackoverflow.com/questions/1051782/jquery-this-vs-this you're using jQuery. If you want jQuery's help to do DOM things just keep this in mind. this 0 this Basically every time you..
Highlight a word with jQuery http://stackoverflow.com/questions/119441/highlight-a-word-with-jquery site so keeping everything wrapped up in jQuery would make things perhaps a bit more tidy. javascript jquery html share improve..
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 use jQuery at all at least until they get used to doing things the Angular Way . I've seen many developers here and on the.. applications that's fine. But for non trivial applications things quickly get confusing and hard to maintain. In AngularJS though.. else element .addClass 'active' on on There are a few things wrong with this. First jQuery was never necessary. There's nothing..
Regular expression to match non-english characters? http://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters the language may not be English so I will need to match things like ü ö and ñ. Also this is in javascript jquery so any solution..
Why I have to put all the script to index.html in jquery mobile http://stackoverflow.com/questions/15800121/why-i-have-to-put-all-the-script-to-index-html-in-jquery-mobile jQuery Mobile documentation is big but lacking many things . Solution 1 In your second page and every other page move your..
How to access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?> http://stackoverflow.com/questions/1808108/how-to-access-php-variables-in-javascript-or-jquery-rather-than-php-echo-vari JavaScript. You can also use json_encode for more complex things like arrays php simple 'simple string' complex array 'more'..
jquery data selector http://stackoverflow.com/questions/2891452/jquery-data-selector Are there other implementations that support these things or are better in some way jquery jquery selectors share improve..
How to get a table cell value using jquery? http://stackoverflow.com/questions/376081/how-to-get-a-table-cell-value-using-jquery
how to get GET and POST variables with JQuery? http://stackoverflow.com/questions/439463/how-to-get-get-and-post-variables-with-jquery document.write _POST test script While you're at it doing things on server side you might collect the GET parameters on PHP as..
How to disable scrolling temporarily? http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily The scroll event cannot be canceled. You can cancel 2 things however mouse scroll and buttons associated with scrolling...
Change the selected value of a drop-down list with jQuery http://stackoverflow.com/questions/499405/change-the-selected-value-of-a-drop-down-list-with-jquery my selector stupid ASP.NET client ids... . Here are a few things I've tried ._statusDDL .val 2 Doesn't find 2 as a value. ._statusDDL..
Is it possible to use Ajax to do file upload? http://stackoverflow.com/questions/543926/is-it-possible-to-use-ajax-to-do-file-upload in it. I haven't used it to do this but I've heard good things. As pointed out in the comments you can also use something like..
Official way to ask jQuery wait for all images to load before executing something http://stackoverflow.com/questions/544993/official-way-to-ask-jquery-wait-for-all-images-to-load-before-executing-somethin and window .load to execute something when all other things are loaded as well such as the images. The difference can be..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr 1.6. My advice remains the same but jQuery 1.6.1 changed things slightly in the face of the predicted pile of broken websites.. state except in some older versions of IE thus making things still harder . The attribute tells you nothing about the whether..
Can't append <script> element http://stackoverflow.com/questions/610995/cant-append-script-element the script tag but when you do them with built in commands things go better. Try this var script document.createElement 'script'..
Submitting a form on 'Enter' with jQuery? http://stackoverflow.com/questions/699065/submitting-a-form-on-enter-with-jquery issue Adobe AIR uses Webkit for HTML or if I've bunged things up I tried '.input' .keypress function e if e.which 13 'form#login'..
jQuery disable SELECT options based on Radio selected (Need support for all browsers) http://stackoverflow.com/questions/877328/jquery-disable-select-options-based-on-radio-selected-need-support-for-all-brow what select option values should remain. There's a lot of things that could be done to abstract this further let me know if you..
jQuery Menu and ASP.NET Sitemap http://stackoverflow.com/questions/103630/jquery-menu-and-asp-net-sitemap to have it working now so thought I'd post my findings... Things I needed Superfish which also includes a version of jQuery CSS..
How do I use jQuery to select all children except a select element http://stackoverflow.com/questions/1125700/how-do-i-use-jquery-to-select-all-children-except-a-select-element to select all everything in the div except the select. Things I've tried #container not select #container not #selectorid..
Converting Java Object to JSON? http://stackoverflow.com/questions/12263468/converting-java-object-to-json recommend putting this kind of code into a JSP though. Things like these should live in a controller like a Servlet or Action..
Why do the :not() and :has() selectors allow quoted arguments? http://stackoverflow.com/questions/12475595/why-do-the-not-and-has-selectors-allow-quoted-arguments functions should in fact match edit As of jQuery 1.8.2 Things have been refactored somewhat and positional pseudos no longer..
Jquery AJAX not working in IE9 http://stackoverflow.com/questions/12592209/jquery-ajax-not-working-in-ie9 It is like IE9 is just complete ignoring the .ajax chunk. Things I have tried Turn Ajax Caching Off URL encoded my request URL..
Accessing functions bound to event handlers with jQuery http://stackoverflow.com/questions/2388030/accessing-functions-bound-to-event-handlers-with-jquery find a lot of interesting tips and tricks in this article Things you may not know about jQuery . It seems that jQuery use data..
jQuery ajax upload file in asp.net mvc http://stackoverflow.com/questions/2428296/jquery-ajax-upload-file-in-asp-net-mvc this question Upload files using AJAX in ASP.Net MVC Things have changed since HTML5 JavaScript document.getElementById..
Binding to the scroll wheel when over a div http://stackoverflow.com/questions/3715496/binding-to-the-scroll-wheel-when-over-a-div canvas is not. It's offset is controlled via my scripts. Things to note I'm using jQuery as my base. I'm not acually scrolling..
How to properly escape html sent as data in jQuery's .ajax function http://stackoverflow.com/questions/4122298/how-to-properly-escape-html-sent-as-data-in-jquerys-ajax-function use POST and this is why I'm truncating the html data. Things work if the html is nice but if it contains characters javascript..
How would you go about for switching a site from Prototype to jQuery http://stackoverflow.com/questions/53555/how-would-you-go-about-for-switching-a-site-from-prototype-to-jquery about The big rewrite and why it's such a bad idea in Things you should never do Part 1 . It's well worth a read For more..
Problem performing Ajax call from ASP.NET MVC2 app http://stackoverflow.com/questions/5371658/problem-performing-ajax-call-from-asp-net-mvc2-app PostViewModel model return Json new Value This is a test Things to note the data hash property of a jquery AJAX call needs to..
Is there a DOM event that fires when an HTML select element is closed? http://stackoverflow.com/questions/6207929/is-there-a-dom-event-that-fires-when-an-html-select-element-is-closed if you hit escape instead of clicking off the select. Things were easier in Safari where a mousedown event on the select..
Send json data with jquery http://stackoverflow.com/questions/6587221/send-json-data-with-jquery 'json' async false success function msg alert msg Things to notice Usage of the JSON.stringify method to convert a javascript.. so that you don't need to specify the dataType property. Things to be careful about What you call arr is not an array . It is..
Problem with jQuery in Internet Explorer 8 http://stackoverflow.com/questions/879137/problem-with-jquery-in-internet-explorer-8 improve this question I was having a similar issue. Things worked in IE6 Firefox and IE8 running in IE7 compatibility mode..
jQuery on iPhone/Android/BlackBerry http://stackoverflow.com/questions/921130/jquery-on-iphone-android-blackberry experience is that changing the DOM is unexpectedly slow. Things that fly on the emulator can drag on the device. You mentioned..
jQuery $(this) vs this http://stackoverflow.com/questions/1051782/jquery-this-vs-this this share improve this question Yes you only need when you're using jQuery. If you want jQuery's help to do DOM things just keep this in mind. this 0 this Basically every time you get a set of elements back jQuery turns it into an array. If..
Highlight a word with jQuery http://stackoverflow.com/questions/119441/highlight-a-word-with-jquery the text itself. I'm already using jQuery heavily on this site so keeping everything wrapped up in jQuery would make things perhaps a bit more tidy. javascript jquery html share improve this question Try highlight JavaScript text higlighting..
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 is why I always recommend that new AngularJS developers don't use jQuery at all at least until they get used to doing things the Angular Way . I've seen many developers here and on the mailing list create these elaborate solutions with jQuery plugins.. obvious that there is any functionality here. For small applications that's fine. But for non trivial applications things quickly get confusing and hard to maintain. In AngularJS though the view is the official record of view based functionality... .click function if on element .removeClass 'active' else element .addClass 'active' on on There are a few things wrong with this. First jQuery was never necessary. There's nothing we did here that needed jQuery at all Second even if..
Regular expression to match non-english characters? http://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters like to match all words individually in an input string but the language may not be English so I will need to match things like ü ö and ñ. Also this is in javascript jquery so any solution will need to apply to that. javascript jquery regex ..
Why I have to put all the script to index.html in jquery mobile http://stackoverflow.com/questions/15800121/why-i-have-to-put-all-the-script-to-index-html-in-jquery-mobile knowledge or they forgot to describe this like my other topics. jQuery Mobile documentation is big but lacking many things . Solution 1 In your second page and every other page move your SCRIPT tag into the BODY content like this body div data..
How to access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?> http://stackoverflow.com/questions/1808108/how-to-access-php-variables-in-javascript-or-jquery-rather-than-php-echo-vari shows the most simple way of passing PHP variables to JavaScript. You can also use json_encode for more complex things like arrays php simple 'simple string' complex array 'more' 'complex' 'object' array 'foo' 'bar' script type text javascript..
jquery data selector http://stackoverflow.com/questions/2891452/jquery-data-selector like sub property dot notation and multiple data selectors. Are there other implementations that support these things or are better in some way jquery jquery selectors share improve this question I've created a new data selector that..
How to get a table cell value using jquery? http://stackoverflow.com/questions/376081/how-to-get-a-table-cell-value-using-jquery
how to get GET and POST variables with JQuery? http://stackoverflow.com/questions/439463/how-to-get-get-and-post-variables-with-jquery type text javascript var _POST php echo json_encode _POST document.write _POST test script While you're at it doing things on server side you might collect the GET parameters on PHP as well var _GET php echo json_encode _GET Note You'll need PHP..
How to disable scrolling temporarily? http://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily javascript jquery scrolling share improve this question The scroll event cannot be canceled. You can cancel 2 things however mouse scroll and buttons associated with scrolling. Working demo left 37 up 38 right 39 down 40 spacebar 32 pageup..
Change the selected value of a drop-down list with jQuery http://stackoverflow.com/questions/499405/change-the-selected-value-of-a-drop-down-list-with-jquery to do this with jQuery because I'm using a CSS class for my selector stupid ASP.NET client ids... . Here are a few things I've tried ._statusDDL .val 2 Doesn't find 2 as a value. ._statusDDL .children option .val 2 Also failed. How can I do it..
Is it possible to use Ajax to do file upload? http://stackoverflow.com/questions/543926/is-it-possible-to-use-ajax-to-do-file-upload create this iframe for you if your form has any file fields in it. I haven't used it to do this but I've heard good things. As pointed out in the comments you can also use something like the very popular SWFUpload to accomplish the desired effect..
Official way to ask jQuery wait for all images to load before executing something http://stackoverflow.com/questions/544993/official-way-to-ask-jquery-wait-for-all-images-to-load-before-executing-somethin use document .ready to execute something when the DOM is loaded and window .load to execute something when all other things are loaded as well such as the images. The difference can be seen in the following complete HTML file provided you have..
.prop() vs .attr() http://stackoverflow.com/questions/5874652/prop-vs-attr 2012 My original answer applies specifically to jQuery 1.6. My advice remains the same but jQuery 1.6.1 changed things slightly in the face of the predicted pile of broken websites the jQuery team reverted attr to something close to but not.. value reflects the default rather than the current visible state except in some older versions of IE thus making things still harder . The attribute tells you nothing about the whether the checkbox on the page is checked. See http jsfiddle.net..
Can't append <script> element http://stackoverflow.com/questions/610995/cant-append-script-element I mean creating the HTML from text like you're trying with the script tag but when you do them with built in commands things go better. Try this var script document.createElement 'script' script.type 'text javascript' script.src url #someElement..
Submitting a form on 'Enter' with jQuery? http://stackoverflow.com/questions/699065/submitting-a-form-on-enter-with-jquery the form isn't submitted. Does anyone know if this is a Webkit issue Adobe AIR uses Webkit for HTML or if I've bunged things up I tried '.input' .keypress function e if e.which 13 'form#login' .submit But that neither stopped the clearing behavior..
jQuery disable SELECT options based on Radio selected (Need support for all browsers) http://stackoverflow.com/questions/877328/jquery-disable-select-options-based-on-radio-selected-need-support-for-all-brow keys are the radio ID to match and the value is an array of what select option values should remain. There's a lot of things that could be done to abstract this further let me know if you are interested and I could certainly do that. Here is a demo..
jQuery Menu and ASP.NET Sitemap http://stackoverflow.com/questions/103630/jquery-menu-and-asp-net-sitemap it's possible but no one gives the actual solution I seem to have it working now so thought I'd post my findings... Things I needed Superfish which also includes a version of jQuery CSS Friendly Control Adaptors download DLL and .browsers file..
How do I use jQuery to select all children except a select element http://stackoverflow.com/questions/1125700/how-do-i-use-jquery-to-select-all-children-except-a-select-element with many elements in it including a select element. I'd like to select all everything in the div except the select. Things I've tried #container not select #container not #selectorid put a div around the select and... #container not #selectorcontainer..
Converting Java Object to JSON? http://stackoverflow.com/questions/12263468/converting-java-object-to-json Gson gson new Gson String json gson.toJson yourMap I wouldn't recommend putting this kind of code into a JSP though. Things like these should live in a controller like a Servlet or Action class. You also most definitely don't want the output to..
Why do the :not() and :has() selectors allow quoted arguments? http://stackoverflow.com/questions/12475595/why-do-the-not-and-has-selectors-allow-quoted-arguments aware. Are there situations where non numeric arguments to such functions should in fact match edit As of jQuery 1.8.2 Things have been refactored somewhat and positional pseudos no longer receive the raw argument. As a result quoted arguments are..
Jquery AJAX not working in IE9 http://stackoverflow.com/questions/12592209/jquery-ajax-not-working-in-ie9 I look at the web debugger there are no errors in the logs. It is like IE9 is just complete ignoring the .ajax chunk. Things I have tried Turn Ajax Caching Off URL encoded my request URL Went back to three older versions of Jquery Manually pinged..
Accessing functions bound to event handlers with jQuery http://stackoverflow.com/questions/2388030/accessing-functions-bound-to-event-handlers-with-jquery Edit the method below works only in jQuery 1.7 You can find a lot of interesting tips and tricks in this article Things you may not know about jQuery . It seems that jQuery use data to store event handlers You can access all event handlers..
jQuery ajax upload file in asp.net mvc http://stackoverflow.com/questions/2428296/jquery-ajax-upload-file-in-asp-net-mvc with the ajax request jquery asp.net mvc ajax share improve this question Upload files using AJAX in ASP.Net MVC Things have changed since HTML5 JavaScript document.getElementById 'uploader' .onsubmit function var formdata new FormData FormData..
Binding to the scroll wheel when over a div http://stackoverflow.com/questions/3715496/binding-to-the-scroll-wheel-when-over-a-div work if the div under the wheel is set to scroll itself. My canvas is not. It's offset is controlled via my scripts. Things to note I'm using jQuery as my base. I'm not acually scrolling anything I'm trying to bind and event to the scroll wheel..
How to properly escape html sent as data in jQuery's .ajax function http://stackoverflow.com/questions/4122298/how-to-properly-escape-html-sent-as-data-in-jquerys-ajax-function error function stuff I need to use JSONP and therefore I can't use POST and this is why I'm truncating the html data. Things work if the html is nice but if it contains characters javascript doesn't like then I have problems. I fixed my ' problem..
How would you go about for switching a site from Prototype to jQuery http://stackoverflow.com/questions/53555/how-would-you-go-about-for-switching-a-site-from-prototype-to-jquery or not this applies to you but Spolsky had a great article about The big rewrite and why it's such a bad idea in Things you should never do Part 1 . It's well worth a read For more on using jquery with Prototype see Using jQuery with other..
Problem performing Ajax call from ASP.NET MVC2 app http://stackoverflow.com/questions/5371658/problem-performing-ajax-call-from-asp-net-mvc2-app Postid get set and then public ActionResult PostBlogComment PostViewModel model return Json new Value This is a test Things to note the data hash property of a jquery AJAX call needs to be as my example or you would be sending a JSON encoded string..
Is there a DOM event that fires when an HTML select element is closed? http://stackoverflow.com/questions/6207929/is-there-a-dom-event-that-fires-when-an-html-select-element-is-closed haven't implemented that in my demo and you can see what happens if you hit escape instead of clicking off the select. Things were easier in Safari where a mousedown event on the select signifies opening the select and any close of the select is..
Send json data with jquery http://stackoverflow.com/questions/6587221/send-json-data-with-jquery arr contentType 'application json charset utf 8' dataType 'json' async false success function msg alert msg Things to notice Usage of the JSON.stringify method to convert a javascript object into a JSON string which is native and built.. response into a javascript object into the success callback so that you don't need to specify the dataType property. Things to be careful about What you call arr is not an array . It is a javascript object with properties City and Age . Arrays..
Problem with jQuery in Internet Explorer 8 http://stackoverflow.com/questions/879137/problem-with-jquery-in-internet-explorer-8 be missing here javascript jquery internet explorer 8 share improve this question I was having a similar issue. Things worked in IE6 Firefox and IE8 running in IE7 compatibility mode but not in 'normal' IE8. My solution was to put this code..
jQuery on iPhone/Android/BlackBerry http://stackoverflow.com/questions/921130/jquery-on-iphone-android-blackberry will work but you need to test everything carefully. My experience is that changing the DOM is unexpectedly slow. Things that fly on the emulator can drag on the device. You mentioned you'd be using emulators do NOT trust performance you get..
|