Hello, how does the getElementbyTagname and the length of that works ?
Suppose my codes is :
<!DOCTYPE html>
<html>
<body>
<p id="demo">This is demo</p>
<div id="original">This is original</div>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var elements = document.getElementsByTagName("*");
alert(elements.length);
};
</script>
</body>
</html>
Output is 7. Why ?
Besides that, sometimes getElementByTagname("P")[0] end with the array, izit determine the position of the tagName ?