Skip to Navigation or
Skip to Content

Ultimate JavaScript Stuff JQuery

Feeds

RSS Feed

<< June | July | August >>

Tuesday, 8th July 2008

So what is it? It's a framework. It makes writing JavaScript more structured, less buggy and much cleaner. Once you get the hang of it, you can write something in one line that you used to do on twenty lines.

It's available via the official JQuery website and if you're doing a lot of JavaScript development it will change your life!

I'm currently working on a project that utilises JQuery a lot and it also helps you to follow the Fenton JavaScript ethos, which is great news.

Here's an example... we want to add an event to this anchor tag...

<a href="a_real_page.html" id="alert">Alert</a>

So in old school terms we do this:

document.getElementById("alert").onclick = function() {
alert('Hello World!');
return false;
}

And in the new skool we do this:

$("#alert").click(function() { alert("Hello World!"); return false; });

It looks a bit odd at first, but when you start doing complicated stuff, you suddenly realise how much time and effort you can save!

 

You Are Here: Home » Blog » Ultimate JavaScript Stuff JQuery

 

I use a cookie on this website. This cookie doesn't contain or relate to any personal information and it isn't shared with any other website, it just ensures that I don't count you more than once in my website statistics. The Privacy and Electronic Communications Regulations require me to ask your permission to use this cookie, so please indicate below that you are happy for me to do this - I will remember your selection with a cookie, so if you accept I won't ask again...