jQuery — An Exploration

To $ or Not To $

If you’re like me, when Google searching for help with JavaScript, you’ve come across all kinds of answers involving jQuery. Wait, what? What is jQuery? (And why is JavaScript called “Vanilla JavaScript”?)

I thought I would do a little tooling around on the interwebs to find out more. Is jQuery worth learning? Is it still used in the dev community? A quick Google search starting with “is jQuery…” returned:

Simple Google Search on jQuery

According to Wikipedia: “jQuery was originally created in January 2006 at BarCamp NYC by John Resig… designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax
(Note: BarCamp is a series of software developers’ conferences that was created as a response to the more selective/invite-only FooCamp.)

Here is a quick intro to jQuery from w3schools:

The jQuery syntax is tailor-made for selecting HTML elements and performing some action on the element(s).

Basic syntax is: $(selector).action()

  • A $ sign to define/access jQuery
  • A (selector) to “query (or find)” HTML elements
  • A jQuery action() to be performed on the element(s)

jQuery is basically a library of JavaScript shortcuts primarily used for various types of DOM (Document Object Model) Manipulation. The concept — in addition to the ability to write extremely concise code — is the separation of concerns. You do not have to, but you can write your jQuery code directly in your HTML doc!

The list of jQuery actions is extensive. And jQuery is really easy to set up and fun to play around with, particularly if you already have some experience with JavaScript. Just implement the following steps in your code editor to get started:

  1. Create a new directory;
  2. Create a new HTML doc inside this directory;
  3. Download the one page jQuery library doc/move it into the above directory;
  4. Add a referential script tag in your HTML doc so you can use the jQuery library (make sure this tag src is identical to the name of your jQuery library file);
  5. Add one more script tag that you will write your jQuery in; and…
  6. Get to work!
This is where you’ll write your jQuery code, right inside your HTML doc!

The code above works the same way that the event listener DOM Content Loaded does. I followed the steps as recommended at learn.jquery.com, it was super easy! See below:

A Few Lines of Code Show How jQuery Can Easily Perform CSS Styling and DOM Manipulation
Simple HTML Formatting
Event Listeners, Easy Breezy!

There are lots of video tutorials out there to help you get started. I like the short videos posted by LearnCode.academy. After watching a few brief videos, you’ll be able to do much more than just click buttons. You can also animate elements using fadeIn(), fadeOut(), slideUp(), slideDown(), toggle(), etc. So. Many. Options.

Great tutorial series for learning jQuery

As to whether or not jQuery is still being used, apparently it is! According to w3schools:

jQuery is probably the most popular(JavaScript library), and also the most extendable. Many of the biggest companies on the Web use jQuery, such as:

  • Google
  • Microsoft
  • IBM
  • Netflix

jQuery is supported by all current major desktop browsers (Chrome, Edge, Firefox, IE 9+, Safari, Opera) as well as Android and Safari for mobile devices. And have I mentioned that it’s fun and relatively easy to learn??

As it turns out JavaScript is indeed sometimes called Vanilla JavaScript because it’s considered “ordinary” by many devs — although not by me. I still have so much to learn! For those who love a good inside joke (as I do), there is actually a document called VanillaJS that you can download for a Vanilla JS framework. It is 0 kb. Because it’s empty. 😆 As per the folks behind TIM/This Interests Me: “VanillaJS is a spoof framework… If you configure the various options and download the vanilla.js file, you will find that it is completely empty. Regardless of which features you selected.”

As to answering the big question of whether or not to learn jQuery, there is no simple answer. As per this very helpful article written by Janeth Kent at ma-no (although they do say that the jQuery trend is on the decline):

JQuery is still in use on a staggering 77 percent of the top 1 million websites, according to BuiltWith. So if you ever find yourself working on such a website, you should know the library. JQuery is a beautiful library apart from popularity. Its methods of chaining are crisp and elegant.

So. If you like to explore and learn, you’ve got nothing to lose. Go for it! Just don’t forget the good old, tried and true Vanilla JS.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store