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){});
Javascript
varrequest=newXMLHttpRequest();request.open('GET','/my/url',true);request.onload=function(){if(this.status>=200&&this.status<400){// Success!vardata=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();
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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
Javascript
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 thandocument.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.