Get a specified element using getElementById() : Document : Development JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Development » Document »

 

Get a specified element using getElementById()



<html>

<head>
<script type="text/javascript">
function getElement(){

    var x=document.getElementById("myHeader")
    alert("I am a " + x.tagName + " element")
    
}
</script>
</head>

<body>
<h1 id="myHeader" onclick="getElement()">Click to see what element I am!</h1>
</body>

</html>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Development
» Document