Native Javascript element selector best practice

rsummerell

Ross Summerell

Posted on March 19, 2019

Native Javascript element selector best practice

Hey all,

So coming from Jquery, I was always told the best method to select an element is to give it a class name and use the $(".someElementClass") method.

However now not using Jquery in my Vue project, what is the best practice for selecting elements.

I am currently giving elements ID's and using the document.getElementById("someElementID");

Very curious to see what peoples opinions are!

💖 💪 🙅 🚩
rsummerell
Ross Summerell

Posted on March 19, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related