Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what does getattribute return null for data-* attributes

//Try this
var e = document.getElementById("your-elements-id");
var data1 = e.getAttribute("data-yourData");
var data2 = e.dataset.yourdata;
 
PREVIOUS NEXT
Tagged: #getattribute #return #null #attributes
ADD COMMENT
Topic
Name
6+6 =