Tutorialsplane

Select element by data attribute in JavaScript


Select element by data attribute in JavaScript : We sometimes need to select element by data attribute in javascript. You can select the element simply using the document.querySelectorAll() in javascript. Here in this tutorial we are going to explain how you can select the element using the data attribute in javascript with example and demo.


Select element by data attribute in JavaScript

You can select the attribute using the data attribute as below –

javascript get element by data attribute value Example:

19293049503

Try it »

If you run the above example it will show you the 19293049503. The output will look something like this-