The getElementsByTagName method of Document interface returns an HTMLCollection
of elements with the given tag name.The getElementsByTagName method of Document
interface returns an HTMLCollection of elements with the given tag name.
we are going to count total number of paragraphs by getElementByTagName.
<html>
<body>
<script>
function countheading(){
var totalheading=document.getElementsByTagName("h5");
alert("total h5 tags are: "+totalheading.length);
}
</script>
<h5>this is a heading</h5>
<h5> we are going to count total number of heading by getElementByTagName<h5>