jQuery Basics

Post on April 26th, 2008

A whole component of the jQuery library is dedicated to the detection and reaction of standard browser events which are likely to occur frequently (during every visit to our page) when visitors view our pages.

One event that is used almost every time the jQuery library is engaged is the ready event. This can be used with the $(document).ready(function(){});. This will execute the code within its curly braces when the document is ready (once the page has finished loading minus images).

Updated September 2009
To learn more about jQuery in detail, you can take my online class, jQuery: Enhancing Web Development
Updated August 2008
Check out my post on how to create an unobtrusive image viewer.

Another extremely useful feature of the events component of jQuery are the Interaction Helpers; there are two of them at present – the .hover() method and the .toggle() method.

Both interaction Helpers specify two functions to be executed; the .hover() method allows you to define anonymous functions to be executed on mouseover and mouseout events, so both related events can be wrapped up in one method.

The .toggle() method simply allows two functions to be executed on alternative click events, so clicking on something once will execute the first function, clicking the same element a second time will then trigger the second function.

Events are the cornerstone of any web 2.0 application and allow you to react to different interactions that take place between your visitors and your application. jQuery makes this task easier for you, and presents a unified event model in which each browser works with events in the same way and has equal access to the event object where it is needed.

Here are three useful articles covering jQuery:

jQuery Events
jQuery CSS
jQuery Effects

From jQuery

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.