I am not talking about prototyping, we can use everything we want to get a prototype fast and easy, but what about our production code?
And it’s slower too!
So, this is a post about using your own selectors!
Get Elements By id
This is an easy one, just call
document.getElementById('your_id'); and you are ready to go!
If you think this is boring we can create a simple wrapper function to help our coding.
Get Elements By Class
Getting elements by class is fairly easy too, but we need to write some code to iterate through the selected elements.
That’s all for now.
Within a few lines of code we saved ourselves a 40kb - 80kb library request and browser memory.