Why We Do Use jQuery at Drake Cooper

Discussion has been brewing in web development circles about the place of JavaScript libraries like jQuery. jQuery is a layer that sits atop JavaScript, the native scripting language of the modern web browser. It provides shorthand for common functions of JavaScript specifically aiding in DOM manipulation. jQuery is also the glue that binds countless open-source plugins. It’s challenging to find a plugin needed to achieve a task not already provided by jQuery or the community of developers writing it. This is key for delivering timely digital campaigns fast.

jQuery has problems

As a designer and front-end developer, my view of jQuery is admittedly skewed. It makes my life much easier. Without jQuery, not only would I be writing more code in native JavaScript to accomplish the same things, but I would be writing my own plugins from scratch for things that we can’t do with CSS alone (modal windows, slideshows and a boatload of touch-driven UI patterns for starters). That said, I’ll admit jQuery isn’t without its problems. The library itself is a bit heavy (96K at last check) and it can be extra slow when written incorrectly. It’s also really really easy to write, which makes it really really really easy to write badly.

Community is critical

My argument in favor of jQuery isn’t rooted in the technical goodness or badness of the library. It’s in the ubiquity. We use open-source technology so that we don’t have to reinvent the wheel for trivial things. This, in turn, lets us focus on the cool stuff that doesn’t exist in the open-source community yet because no one has done it. Hopefully, if what we’re doing is cool enough, it will become a part of that community, further enriching the web and feeding the ecosystem.

For that ecosystem to thrive, it needs an organic common language. As with spoken language, the most technically sound approach isn’t usually the one that wins. The one that wins is usually the most attainable. The authors of jQuery were smart enough to provide a framework to make it really easy to write 3rd party plugins.

Why it helps with design

As I said before, jQuery can be written fast. For example, with the jQuery Colorbox plugin installed, this is all the code that’s needed to instantiate a modal:

$.colorbox(‘Hello world!’);

This is pretty simple, what if we want to pass in more options to our modal? The jQuery plugin model provides the ability to pass in a configuration object, which might look something like this:

$.colorbox({
html: ‘Hello world!’,
width: 500,
height: 200
});

Now, using the configuration options exposed by the plugin’s author, we are able to manipulate the functionality as needed. This is a very basic example, but it demonstrates the ease of setup to do something that would take hundreds of lines of vanilla JavaScript to accomplish without jQuery.

We’re not done here

Something better than jQuery (as we know it) is going to come along. It has to—that’s how these things work. jQuery was just the answer to a question, “how do we make JavaScript easier to write.” When that day comes, it’s not going to be by the fastest library, or the most elegantly written, or even the smartest. It’s going to be the most functional and the most attainable.

Up Next

Why We Don’t Use JQuery at Drake Cooper

jQuery has been the de facto for normalization in the web industry for years now, and its relevance in recent…

Drake Cooper
Drake Cooper
October 1, 20144 min read