We used to use jQuery for a lot of things.
We used to use jQuery for easily selecting elements. This has never been a problem IMO but its now we also have querySelector
which is just as easy as jQuery.
jQ
$('.button')
Vanilla JS
document.querySelector('.button')
We used to use jQuery to wait for the DOM:
jQ
$(document).ready(() => {
//...
})
Vanilla JS
document.addEventListener("DOMContentLoaded", () => {
//...
})
We used to use jQuery to add/remove CSS classes:
jQ
el.addClass('big')
el.removeClass('big')
el.toggleClass('big')
Vanilla JS
el.classList.add('big')
el.classList.remove('big')
el.classList.toggle('big')
We used to use jQuery to simplify AJAX requests. Now we can just use XMLHttpRequest()
.
A lot of frameoworks like Bootstrap ect used to use it. So a lot of people got accustomed to it from there. Bootstrap is/has dropped jQuery (I cant remember if that happened yet). Basically every modern framework is doing the same.
Having some knowledge of jQuery is great. It will come up from time to time for years into the future. Spending a ton of time learning it is not helpful going forward IMO.
More examples: https://flaviocopes.com/jquery/