I don't recall how i found jQuery. Everything before that was kind of a blur.
jQuery is a javascript library that will make your heart race when you first discover how powerful it is. I've been using it for 4 months and have converted a few friends and workmates to the idea that javascript frameworks rock!
There are a few other javascript libraries out there, but for me jQuery sticks out with its dom selector approach and plugins (making the framework lighter). It's totally changed the way i write javascript and how i look at dom objects.
Writing javascript for the jQuery framework helps promote your javascript as a seperate layer. You no longer need to add javascript events to your html. Your html code remains dedicated to data and structure.
Just to tickle your programming tastebuds ive included a more complex example, which i will explain below.
$('div').click(function() {
alert('you have clicked me');
}).hover(function() {
$(this).css('background', '#EFEFEF');
}, function() {
$(this).css('background', '');
}).css({color: 'red'}).hide().fadeIn(1000);
That looks pretty complex, but jQuery is doing a lot of different things. It breaks down into:
$('div')
This is the dom selector. This is where 99% of your jquery code will start from. The selector supports css 1, 2 & 3 + xpath. This returns every single div element from the page.
From there is a matter of apending (method chaining) the methods that will have some sort of effect on the selected dom elements. (If thats too messy for you, you don't have to chain them.)
In this example the click() and hover() methods are events. Hover is a special method that combines mouseover & mouse out (both are available seperately). These events fire your own defined function to do exactly what you want.
Appended to those events are a css update, hide the elements and a animated fadein that occurs over 1 second.
Pretty cool eh?
jquery also has support for ajax, and a really good form plugin that will allow you to convert a standard form into a ajax request.
Check it out!