This element receives a string containing the id of a specific element and returns a reference to it.
After obtaining a reference to the object, you can use the getAttribute and setAttribute methods to modify the element's attributes.
<p id="myID" attr="my attribute value">
...
<script>
var pTag1 = document.getElementById('myID');
document.write(pTag1.getAttribute('attr') + '<br>\n');
pTag1.setAttribute('attr', 'my new attribute value');
document.write(pTag1.getAttribute('attr'));
</script>
my attribute value
my new attribute value