Get going with jQuery!

Please note: This post was written 7 years ago, which is an age in programming terms, so please don't treat this as gospel! I'll be updating all posts soon enough, but if you'd especially like this one to be updated let me know.

JQuery Logo

If you would have asked me 6 month ago what I thought of Javascript, I would have told you I thought it was a precarious language which never worked for me - and that's coming from a semi-programmer! To me the language was cumbersome and seemed like it was cobbled together in a very short time with little regard for the developers (don't shoot me!) . For me I didn't have the time to sit down and trawl through documentation on how to use it, and the idea of writing 100s of lines of code for little gain didn't appeal to me.

However a short time ago I was introduced to jQuery - a Javascript library, and I must say it was one of the best gifts I have ever received. jQuery replaces the annoying syntax of Javascript and introduces an easy to use set of tools that can be implemented by someone with little programming experience. Gone are the days when I spend hours trawling over Javascript code to find errors - now I can reel off 50 lines of jQuery without ever making a mistake! Furthermore it's ease of use means that there are loads of websites advocating it. It is free to download - just search for jQuery, and as I say - easy to use.

jQuery allows you to easily animate elements in a slick and stylish manner - making your websites look far smoother. Integration with AJAX means that form validation is also really easy, and best of all - the documentation is amazing!

So what does it look like?

$("#myDiv")

Would select a div element. Then to manipulate it and say fade it in, you would simply add -

$("#myDiv").fadeIn(1000)

The "1000" indicates the length of the animation - in milliseconds. You can even animate individual CSS properties like so -

$("#myDiv").animate({ background-color:"#000"; }, 2500)

And to react to events use functions such as -

$("body").on('click', '#myDiv', function(){ $("#myDiv").animate({ top:"50px"; }, 2500) });

jQuery is a really simple library to learn your way around, and I would recommend going with it because of it's ease of use alongside the powerful features that it possess! If you have never tried jQuery I would seriously suggest you do; I remember when I first discovered it, I spent about a week just playing around with it animating red squares and other random elements, and I think you should do the same - eventually integrating it into a site of your own!

***

If you found this particularly useful and want to share the ♥ you can donate here.

***

1 Response

  1. cookie

    jquery is incredible. I had written ajax stuff before with normal javascript and it is a nightmare. It's only going to get more popular

    Reply


~ Comments are now closed ~

Get in touch here