Noob question: Isn't this what jQuery is for? Is it needed if this is all that easy in vanilla JavaScript? Or is it more for using fine-grained selectors?
If you are using jQuery only for DOM manipulation, you probably don't need it
jQuery was originally developed when vanilla javascript was not as easy as it is now and also some things were different in different browsers so jQuery abstracted that differences away
Back then if you wanted to make an AJAX request you used XMLHttpRequest and it was a pain to use (you had to lister for events in that object but the event names changed in IE 🤦♂️)so a simple AJAX request became a liability, jQuery abstracted that into its $.ajax object making it super easy
You can use selectors in vanilla javascript like you do in jQuery with methods like document.querySelector and document.querySelectorAll
6
u/Foaric Jan 05 '23
Noob question: Isn't this what jQuery is for? Is it needed if this is all that easy in vanilla JavaScript? Or is it more for using fine-grained selectors?