jwCompactor Demo
| jQuery = Awesometastic |
| Written by Adam McHugh |
| Wednesday, 17 September 2008 12:20 |
|
Every now and again I say Awesomtastic at something, usually it is a once off and then I have a silent appreciation for it there after. However there is one subject / technology that gets me consistently saying Awesometastic! jQuery, a degradable Javascript library capable of tagging onto css ids and classes to remove the unsightly inline Javascript from your incredibly complex website (or even your personal blog).
Enabling the jQuery library for your site is simple, it's just one line. <script type="text/javascript" src="/jquery.js"></script> Now you can start applying jQuery effects and extensions all over your website. Oh and make sure your webpage has a doctype defined, or else Internet Explorer 6 and 7 get into quirks mode (which means things like horizontal centrering and margin:0 auto stop working). So what is the difference between inline Javascript and jQuery? For one, if your Javascript has an error inline it will generate an error or stop your Javascript processing altogether. Thus making your active visitor think twice about staying on the website. So this, <a onclick="doSomething()" href="#">Click!</a> becomes this, <script> // Do something here! alert('You did something, woo hoo!'); });
the .click() function n jQuery allows you to tag onto the class event's click action and then perform the javascript within the scriptlet. How easy is that?! There is a ton of other stuff jQuery can achieve, and I hope to write some more about it in the coming few days. But for the moment check out the jquery.com website and download the latest version so you can start developing on it. |
