javascript get attribute by class code example
Example: javascript get attribute
//HTML
//
var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"
//HTML
//
var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"