Do You Need jQuery?

Facebook
Twitter
LinkedIn

It’s extremely rare to find a website that does not use jQuery on today’s modern web. With faster internet speeds and LTE networks its easy as a developer to use such libraries without thinking twice. However quite often I am finding websites that load jQuery, or even jQuery UI, for a single piece of functionality. Sure it may be easier or quicker but is it really necessary?

For instance showing and hiding an element. This is an easy task to achieve with jQuery. You may have seen the following before. $(“#el”).show(); $(“#el”).hide();

This can done in a few lines of code

document.getElementById(“el”).style.display = “”; document.getElementById(“el”).style.display = “none”;

Another common task is to grab or change the information inside of an element. With jQuery we would use the html() method like so.

$(‘#El’).html()

With straight javascript we simple use innerHtml

document.getElementById(‘el’).innerHTML;

A final example would be obtaining an elements attribute.

jQuery   $(‘#el’).attr(‘attributeName’);

Javascript

document.getElementById(‘el’).getAttribute(“attributeName”);

As you can see for simple tasks jQuery may not be needed. By not using libraries that are not necessary you will in turn speed up your website, help boost your SEO rankings, and give your clients an overall better web browsing experience.

If you are interested in learning more please check out http://youmightnotneedjquery.com/

Facebook
Twitter
LinkedIn

COMPLIMENTARY 20-MINUTE STRATEGY SESSION!

We’re eager to learn about your project. Contact us for a free strategy session.

Let’s Get Started!