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.

jQuery Learning Site

Learning Center Users There's a lot more to learn about building web sites and applications with jQuery than can fit in API documentation. If you're looking for explanations of the basics, workarounds for common problems, best practices, and how-tos, you're in the right place! Authors Too much good information is spread across corners of the … Continue reading

How do I test whether an element exists?

Use the .length property of the jQuery collection returned by your selector: 1 2 3 4 5 if ( $( "#myDiv" ).length ) { $( "#myDiv" ).show(); } Note that it isn't always necessary to test whether an element exists. The following code will show the element if it exists, and do nothing (with no … Continue reading