Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get data attribute value

const article = document.querySelector('#electric-cars');
 
article.dataset.columns // "3"
article.dataset.indexNumber // "12314"
article.dataset.parent // "cars"
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #data #attribute
ADD COMMENT
Topic
Name
8+7 =