ID is a unique name or number used by javascript to access particular element in HTML file .
var x = document.getElementById("color");
getElementById is used to access a particular Id specified in the brackets i.e. color in this case . Variable x references to the particular element that has the ID color .
nodeName property
nodeName property is used to determine the type of element we are accessing through the ID e.g. in this case :
alert ( x.nodeName) ;
would return the type of HTML element to the window screen .
var x = document.getElementById("color");
getElementById is used to access a particular Id specified in the brackets i.e. color in this case . Variable x references to the particular element that has the ID color .
nodeName property
nodeName property is used to determine the type of element we are accessing through the ID e.g. in this case :
alert ( x.nodeName) ;
would return the type of HTML element to the window screen .
No comments:
Post a Comment