javascript get html element by attribute code example
Example 1: dom element get attribute
document.getElementById('id1').getAttribute('attribute');
Example 2: get element attribute javascript
var x = document.getElementsByTagName("H1")[0].getAttribute("class");