Re:You might not need jQuery (2014)
by arp242 on Thursday January 14, 2021 @12:53AM
(#25772634)
There are quite a few more examples of this:
vs:
[ Parent
| on HN ]
Re:You might not need jQuery (2014)
by realityking on Thursday January 14, 2021 @04:41AM
(#25774238)
This is good example of how browser APIs have gotten better:
// Edge 12 document.querySelector('.class').remove();
// Edge 17 document.querySelector('.class').after(...);
Where jQuery shines - but also hides a lot of complexity- is when operating on an array of elements, e.g. if you want to remove all elements with a certain class.
Re:You might not need jQuery (2014)
by jamiesonbecker on Thursday January 14, 2021 @01:09AM
(#25772733)
This kind of code grows explosively in a moderately-sized project, and the sheer volume and verbosity makes it hard to debug. Not to mention requiring more tylenol ;)
Re:You might not need jQuery (2014)
by jarek-foksa on Thursday January 14, 2021 @04:26AM
(#25774107)
The modern DOM equivalent would look almost the same as the jQuery version:
document.querySelector(".class").remove();
document.querySelector(".class").after(...);