Below is a hightlight of a presentation by Bear Bibeault, who gave a break out talk at TheServerSide Symposium entitled “How jQuery Made Bob a Happy Man”. Bear is well-known author of many jQuery books as well as a moderator on the CodeRanch.
1. Overview of jQuery
2. Do More With Less
- Basic Selectors. The most commons selector can match by ID or component CSS type such as $(‘div’) and $(‘myApplication’)
- Positional Selectors. Filtered selection based upon DOM relationships such as $(‘div:first-child’) as defined by CSS3.
- Custom Selectors. jQuery-defined filters that inputs things CSS missed. Example: $(‘:text:disabled’) [selects all text input elements that are disabled].
jQuery also has a very diverse library for event, click, and click handlers. Hard to imagine how we ever lived without them.
3. Plays well with others
jQuery has supported means to give up $() namespace for other tools to use that namespace. In this manner, jQuery and Prototype can be intermixed.
4. DOM Manipulation
5. Chaining jQuery
Common jQuery interactions allow you to chain elements such as $(‘myClass’).css(‘color’,’red’).show().appentTo(‘…’). A little strange to get used but very powerful. There are some functions that do return values and cannot be chained as this.
6. document-ready handler
jQuery offers a document-ready handler that fires immediately after the page has downloaded but before the page has fully displayed. Allows you manipulate items before they have been drawn.
8. More with Plugins
Large variety of plugins available for jQuery that follow similar patterns/structure as the core jQuery API. Most popular ones are jQuery UI for complex UI widgets, and jQuery Forms for advanced form handling. There’s also validation plugin to help simplify creating complex form validation logic. jQuery Templates can be used to create versatile client-side templating. Finally, there’s LiveQuery for notifications and updates about elements being created and destroyed.
Bear reiterates the point “Do more with less and in less time” and in that jQuery is successful.