Is jQuery still needed?
Blog

Is jQuery still needed?

By Matthew Maher  |  Published on January 13, 2015

Netwoven Blog

In the recent months I’ve seen a lot of backlash against jQuery. It is true that when jQuery made it mainstream everyone and their brothers included it on their pages even if it wasn’t needed. Lots of great WordPress plugins also overuse and abuse jQuery on our sites (Netwoven.com included). But even after all this jQuery is an indispensable library in our chest of tools.

The time it would take to write an advanced function like toggleClass is measurable (below is the eleven line JavaScript equivalent). Developers would much rather spend time solving more complex problems than figuring out the JavaScript required to toggle a CSS class. There is also a higher level of knowledge required to be coding in pure JavaScript, jQuery lowers that bar which lets more developers to collaborate on projects.

Javascript translation of toggleClass:

if (elem.classList) {
elem.classList.toggle(className);
} else {
var classes = elem.className.split(' ');
var existingIndex = classes.indexOf(className);

if (existingIndex >= 0) classes.splice(existingIndex, 1); else classes.push(className); elem.className = classes.join(‘ ‘); }

By Matthew Maher

Matt Maher is a technical director with Netwoven who has been working with Fortune 500 companies implementing large scale enterprise systems for the last 15 years. Matt is an early member of the Netwoven team and has helped grow Netwoven from it’s infancy to the current stages. Matt is passionate about blending productivity and security to enable modern workplaces. His leadership and expertise have helped companies build secure, highly effective solutions and applications. Matt holds a BS in Computer and Informational Sciences from the University of Massachusetts.

Leave a comment

Your email address will not be published. Required fields are marked *

Unravel The Complex
Stay Connected

Subscribe and receive the latest insights

Netwoven Inc. - Microsoft Solutions Partner

Get involved by tagging Netwoven experiences using our official hashtag #UnravelTheComplex