* No more tedious JavaScript work
Unless you are obsessively committed to a Web site built either retro style with no bells and whistles, or you use Flash and have more bells and whistles than you know what to do with, you are probably going to be using AJAX to make your Web content happen.
Unless you are obsessively committed to a Web site built either retro style with no bells and whistles, or you use Flash and have more bells and whistles than you know what to do with, you are probably going to be using AJAX to make your Web content happen.
If you have done much JavaScript work you will know firsthand just how tedious the language can be and many of the libraries that aim to simplify using JavaScript are only a marginal improvement. Not so in today’s newsletter topic – meet JQuery.
Despite what I wrote at the beginning of this newsletter, there are some incredibly useful and powerful JavaScript libraries out there but JQuery looks to be in a different class altogether. At only 19KB, it is tiny and doesn’t impose a huge client-side overhead to use it. Along with that it is CSS3 compliant (it supports Cascading Style Sheets version 1, 2, and 3 as well as basic XPath), and operates cross-browser (IE 6.0+, FF 1.5+, Safari 2.0+ and Opera 9.0+) – wow!
To give you an idea of just how staggeringly easy JQuery makes JavaScript programming, consider the problem of reporting the current location of the mouse. And then consider making that work cross-browser. If you had to start this project from scratch you’d probably feel pretty daunted. Using JQuery this is all the code you need:
jQuery(document).ready(function(){
$().mousemove(function(e){
$(‘#status’).html(e.pageX +’, ‘+ e.pageY);
});
})
0, 0
That is ridiculously easy!
To get to grips with how JQuery works check out the excellent documentation http://docs.jquery.com/How_jQuery_Works. This is one of the more professional documentation jobs for an open source freeware project that I’ve seen!
An interesting and incredibly useful part of JQuery are plug-ins. The idea is for users to generate functionality as modules based on JQuery that other users can deploy in their projects. For example, there’s Jörn Zaefferer’s Tooltip plug-in, which creates really smart tooltip bubbles that realign and resize according to where on the page they are called from – no more tooltips that vanish off page! And there’s the Klaus Hartl’s Tabs plug-in, which creates – you guessed it – a tabbed interface. You can find these plug-ins and many more in the JQuery Plugin Repository.
This library is going to become huge and one of the places you’ll see it in the near future is on Network World blogs – there’s a posting in Gibbsblog by Network World’s Executive Editor, Online, Adam Gaffin, on the topic.
If you use JQuery in your Web application please let me know.




