The awesomeness of jQuery

This page was used as "slides" for a talk about jQuery to cjug. You can treat each section below as a "slide". Unfortunately the audio that went with the screencast didn't turn out very well - so you had to be there :-)

What is jQuery

  • jQuery is the "write less, do more" JavaScript library. Current Release is v1.4.2
  • Handles cross browser issues
  • Provides handy DOM manipulation
  • Provides handy style manipulation
  • Ajax support
  • Plugins
  • UI Animations

Why is it gooder than other JS libs?

  • Simple JavaScript
  • Using CSS(3) selectors for applying behaviour - "Unobtrusive JavaScript" removing behaviour from the structure
  • Rapid development focus e.g.
    $("table tr:nth-child(even)").addClass("striped");
    1blah 1
    2blah 2
    3blah 3
    4blah 4
  • DOM Elements from markup
  • Extensibility
  • Documentation
  • Momentum - used by everyone from Google to Microsoft

How you use it

Insert the jQuery Lib into <head>

<script src='/js/jquery/jquery-1.4.js'></script>

$("selectStuff").doSomthing().doSomethingElse()... e.g.

$("#clickThisCode").click(function(event) {
$(this).slideUp();
});

Multiple chained event handlers add another event handler to the above location with the code:

var dolert = function() {
alert("clicked it");
}
$("#clickThisCode").bind('click', dolert);

Remove the handler with:

$("#clickThisCode").unbind('click', dolert);

Examples


Copyright © nerdErg Pty Ltd 2012 ABN 20 159 294 989