how to read an attribute value from html element code example Example: javascript element read attribute document.getElementById('id1').getAttribute('attribute');