DEV Community

[Comment from a deleted post]
Collapse
 
gneissguise profile image
Justin Frost
const $ = (tag) => document.querySelector(tag);
Enter fullscreen mode Exit fullscreen mode

This is a pretty handy alias for querySelector!

There are some nice things about jQuery's $ selector function though.. namely the ability to create tags and attach them to existing Dom nodes in one line. (Lots of cool one liner chained functions are possible!)

It also has some more neato advanced Dom traversal features, and more entensive selector syntax. Now that I think about it, you can even just the jQuery $ func as an analog to document.onLoad!

Some may say it's bloat, and may point to alternative ways to do the same things in vanilla js, but it's nice that jQuery has it all in one, and is pretty easy to learn. No need to sit down and learn an entire framework just to have the ability to make dynamic changes to existing html page! It even comes in a variety of min bundles and cdns making it easy to source.

Would I want to build an entire stateful front end web application with only jQuery? Hell nope.