For the one or two of you that don't know what JQuery is....
from JQuery.com:
"jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript."
and it does...
How does it do the voodoo that it does so well?
In the 30,000 ft. view, JQuery converts the entire rendered HTML document to Javascript, which gives it access to the DOM and events.. Now that you know that, store it in the back of your mind somewhere, because the only time you'll need it is if someone asks you, "How does JQuery work?".
There are a few things that you do need to be concerned with in order to implement JQuery, whether you're using ColdFusion or not.
Concept 1. when does the magic happen
JQuery handles things differently than Javascript traditonaly does, under normal circumstances you'd wrap up your Javascript in a window.onLoad() event, and wait until the page rendered, before anything happens.
JQuery circumvents this with the ready event. this checks the document and starts once it is ready to be manipulated. it looks like this:
$(document).ready(function(){ // Your code here });
Concept 2: selectors
a selector can be a tag ("a") or an id (id="foo"). We'll build on the existing code
$(document).ready(function(){ $("a").click(function() { alert("Hello world!"); }); });
In this case we're using the tag "a" we could've just as easily used an ID
$(document).ready(function(){ $("#IDName").click(function() { alert("Hello world!"); }); });
If you''ve not used JQuery before, here's the place to start:
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery