The Small Idea
My plan behind the underscore library is to keep it small and simple. I don’t want to add a bunch of extra features and snazzy functions, just the basic functions to simplify vanilla js a bit.
The syntax of the underscore library is very similar to jQuery: you can select and create elements using the _ function:
const heading = _("h1"); const new_heading = _("<h2>");
You can also use the _ function to select elements by id or class:
const my_div = _("#my-div"); const my_divs = _(".my-div");
The library also contains a lot of manipulation functions, like .attribute or .class to change the attributes or classes connected with the elements.
You can use the underscore library by downloading or linking directly to underscore.js:
<script src="https://cdn.maxpelic.com/underscore/v1/underscore.js" defer>
Learn more at github.com/maxpelic/js.