Html & Html5

it training classes Logo

The World's best Software Development Study Portal

Js getElementByName

Javascript getElementByName example ,we going to count total number of element. we are using getElementByName method to get all the element.




       function totalelements()


 var allelements=document.getElementsByName("element");

 alert("Total Elements:"+allelements.length);




Element1:<input type="radio" name="element" value="element1">

Element2:<input type="radio" name="element" value="element2">

<input type="button" onclick="totalelements()" value="Total Elements">



Element1: Element2:

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