how to get value of attribute in javascript getelementbyid code example Example: dom element get attribute document.getElementById('id1').getAttribute('attribute');