JQuery makes JavaScripting really easy
As I mentioned in my recent post about programming, it’s good for a web developer to know how to program. I dabble in a little code here and there, and as a result, I find web development that little bit easier. I have a general idea about how programming works. However, I’ve never been good enough or known enough to be able to implement AJAX, until now.
According to jQuery’s website, jQuery is, “a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.” I’m not going to argue with that definition, because it really does simplify programming with JavaScript.
I’ve even setup an example on aaronfalloon.com. Look at the sidebar to the right and click the header “About”. Not bad eh? Then double click the header to make the text disappear. That little trick was easy to implement, and it adds a little dynamic touch to my blog (even if it is just showing off).
All it took to achieve that effect was for me to upload the one (and only) jQuery file to my web space, and add this little snippet of code –
$(document).ready(function() {
$("h3.show").click(function(){
$("p.hide").show("slow");
});
$("h3.show").dblclick(function(){
$("p.hide").hide("slow");
});
});
However, it isn’t as unobtrusive as I would like, if a user has JavaScript turned off, no about text is shown. I’ll have to work on it a bit more, after all the user comes first. (UPDATE: I decided to remove this portion of code as it serves no truly useful function.)
Don’t get me wrong, don’t go wild and add this sort of thing everywhere. JavaScript and AJAX should only be used where actually useful.
I’d really encourage you to have a look at jQuery, if you haven’t already done so. It could be that little extra touch your site needs.
If you liked this post, how about subscribing to my RSS feed via e-mail?
Related posts:Make A Comment: ( 2 so far )
2 Responses to “JQuery makes JavaScripting really easy”
Paul
February 15th, 2008
* <noscript> . it got filtered out =P
Paul
February 15th, 2008
I <3 jQuery. It allows you to perform tasks quickly and efficiently. About that javascript turned off thing.. I think you may be able to use tags and then put the text you want in there.. so in two places total. Might just work.