get id html code example
Example 1: html id
<p id="newid">this is the id</p>
<style>
#newid {
background-color: green;
text-align: center;
}
</style>
Example 2: javascript change element id
var element = document.getElementById("oldID");
element.id = "newID";
Example 3: get id of element javascript
var element = document.getElementsByTagName("div")[0];
var id = element.id;
Example 4: html id
<style>
#grepperHeader {
background-color: lightblue;
color: navy;
padding: 40px;
text-align: center;
}
</style>
<h1 id="grepperHeader">grepperHeader</h1>