DEV Community

Discussion on: Do you still work with jQuery?

Collapse
 
nataliedeweerd profile image
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝

Predominantly the readability. I find jQuery a lot easier to read than JS.

I see this site referenced a lot: youmightnotneedjquery.com/ But all it does for me is prove how much I prefer jQuery!

Take the getJson function for example:

jQuery

$.getJSON('/my/url', function(data) {

});
Enter fullscreen mode Exit fullscreen mode

Javascript

var request = new XMLHttpRequest();
request.open('GET', '/my/url', true);

request.onload = function() {
  if (this.status >= 200 && this.status < 400) {
    // Success!
    var data = JSON.parse(this.response);
  } else {
    // We reached our target server, but it returned an error

  }
};

request.onerror = function() {
  // There was a connection error of some sort
};

request.send();
Enter fullscreen mode Exit fullscreen mode

I know which I prefer...

jQuery also comes with the added benefit of slideToggle() functions, fadeIn/Out() functions, etc.

And I can just $('.classname') to target something, rather than document.getElementsByClassName(className)... it's just such an effort to write that much.

Time is money, and jQuery helps me do what I need to do quicker ! :)

I appreciate my team and I would need to transition to Vanilla JS if we start to use more frontend frameworks, and we are looking to bring in Vue to some of our projects in the future. But our LAMP systems (Wordpress/Drupal/CodeIgnighter) are still our bread-and-butter projects, and using jQuery in them just makes our lives easier.

I'd also argue modern frontend frameworks are still mostly in their adolescent stages, where they're still trying to stabilise themselves/their role in the future of the web... Vue has been around for 7 years, React 8 years, and Angular only 5 years; whereas jQuery has evolved over 15 years and understands its place in the world.