|
|
|
|
|
by knoebber
970 days ago
|
|
I think the main use case today is the dom traversal API. It makes operations like "add the 'error' class to all <input> elements in the form" simple: $('#some-form').find('input').addClass('error')
Obviously you can do this in vanilla JS, but it's more cumbersome so you'll probably end up rewriting your own less complete version of jquery. There is some value to using a well worn library with public documentation that other developers can find/extend instead of a home grown solution.With that said, I wouldn't use it for a green field project. For sites that require lots of interactivity I would pick a modern front end framework that doesn't require this kind of manual dom traversal (probably phoenix/liveview). |
|
That's also doing things "the right way" and not do-all selectors, but that option exists now, too:
If you want to make it a little less verbose: