×

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.

<html>

<body>

<script>

       function totalelements()

 {

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

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

 }

</script>

<form>

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

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

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

</form>









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