What is jQuery?

jQuery is a JavaScript library that provides an easy way for developers to add JavaScript to their websites.

jQuery is an open source and cross-platform JavaScript library that can help web developers perform document traversal and manipulation, event handling, animation, Ajax, applying styles, and more.

jQuery was originally released in January 2006 by John Resig, and it is now maintained by a group of developers.

jQuery has become the most popular JavaScript library on the web. jQuery's popularity is quite likely due to its ease of use, and vast functionality.

What can jQuery Do?

jQuery can do lots of things! Most developers use jQuery to provide interactivity to their website. jQuery makes it easy to mainipulate the document object model (DOM). So it's quite trivial to provide dynamic effects such as hiding elements on the fly, changing colors on the fly, and much more.

Here's a quick example of the sort of thing you can do in jQuery:

You can use jQuery to create expanding/collapsing content — like this!

jQuery makes this sort of thing very easy.

Benefits of jQuery

jQuery's tagline is write less, do more. And it's a fitting tagline.

jQuery allows you to get a lot of functionality out of a small amount of code. It allows you to add useful features to your site with a lot less code than if you'd done it using pure JavaScript.

For example, jQuery makes it easy to do the following:

  • Add collapsable/expandable content.
  • Add animation
  • Change CSS styles dynamically
  • Perform Ajax requests (i.e. dynamically pull data from another location without refreshing the page)
  • Create widgets for your site
  • General HTML/DOM manipulation

There's also a large number of jQuery plugins that you can use to add all sorts of tasks and widgets to your website.

Cross-Browser

Another major benefit of jQuery is its browser compatability. jQuery is a cross-browser library, so you don't need to worry about whether your code will work in all browsers.

With jQuery, you write one piece of code, and it will work in any of the supported browsers (which is all major browsers).

jQuery supports desktop browsers such as Chrome, FireFox, Edge, Internet Explorer, Safari, and Opera. Mobile browsers include the stock browser on Android and Safari on iOS.

If you were to use straight JavaScript, you'd likely find yourself having to write lots of extra code just to cater for different browsers.

I'm a Beginner... can I still learn jQuery?

Yes, beginners can still learn jQuery. However, you should start with HTML and CSS before learning jQuery. jQuery is all about working with these two technologies.

It will also help if you know JavaScript, as jQuery is built using JavaScript. But this isn't an absolute requirement, as it is still possible to follow the examples in this tutorial without being well versed in JavaScript. But I definitely recommend that you learn JavaScript as soon as possible after finishing this tutorial, as it will give you a greater understanding of why jQuery works the way it does.

Also, JavaScript is an essential part of any web developer's toolkit (along with HTML and CSS) so definitely check it out.