getElementsByTagName is used to get a list of elements with a specified TagName. The returned list will basically be a live HtmlCollection ff elements in the same order as in the source file.
The Indexing of Returned listwhere list elements are called as Nodes of HtmlCollection starts at 0.
Syntax
document.getElementsByTagName(TagName)
Examples
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard