Answers for "js select elements by data attribute"

0

how to select data attribute in javascript

const link = document.querySelector('[data-link="1"]');
Posted by: Guest on April-07-2021
5

javascript get data attribute value

const article = document.querySelector('#electric-cars');
 
article.dataset.columns // "3"
article.dataset.indexNumber // "12314"
article.dataset.parent // "cars"
Posted by: Guest on April-15-2020

Code answers related to "js select elements by data attribute"

Code answers related to "Javascript"

Browse Popular Code Answers by Language