Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get attribute

//HTML
//<div id="elem" data-id="4hJ3s"></div>

var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"
 
PREVIOUS NEXT
Tagged: #javascript #attribute
ADD COMMENT
Topic
Name
1+6 =