Code Organization
Understanding the basic mechanics is one thing, but the essence of building applications is understanding how to organize code so that it is navigable and well-encapsulated instead of a whole slew of global functions.
Understanding the basic mechanics is one thing, but the essence of building applications is understanding how to organize code so that it is navigable and well-encapsulated instead of a whole slew of global functions.
Use the source as your documentation. Bookmark the source code and refer to it often.
The DOM is slow; you want to avoid manipulating it as much as possible. jQuery introduced detach() in version 1.4 to help address this issue, allowing you to remove an element from the DOM while you work with it. 1 2 3 4 5 6 7 8 var table = $( "#myTable" );var parent = … Continue reading
If you have a variable containing a DOM element, and want to select elements related to that DOM element, simply wrap it in a jQuery object. 1 2 3 var myDomElement = document.getElementById( "foo" ); // A plain DOM element. $( myDomElement ).find( "a" ); // Finds all anchors inside the DOM element. Many people … Continue reading
You can enable or disable a form element using the .prop() method: 1 2 3 4 5 // Disable #x$( "#x" ).prop( "disabled", true ); // Enable #x$( "#x" ).prop( "disabled", false );
You can check or uncheck a checkbox element or a radio button using the .prop() method: 1 2 3 4 5 // Check #x$( "#x" ).prop( "checked", true ); // Uncheck #x$( "#x" ).prop( "checked", false );
jQuery Mobile is the easiest way to build sites and apps that are accessible on all popular smartphone, tablet, and desktop devices. This framework provides a set of touch-friendly UI widgets and an AJAX-powered navigation system to support animated page transitions.