Html & Html5

it training classes Logo

The World's best Software Development Study Portal

Js getElementById

getElementById is unique within an HTML document. If the HTML document has multiple elements with the same id, the document. getElementById() method returns the first element it encounters.

Javascript getElementById method example




       function getcube(){

var number=document.getElementById("number").value;





Number:<input type="text" id="number" name="number" />

<button type="button" value="cube" onclick="getcube()">submit</button>






JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute