232k views
5 votes
Which method returns a collection of references to all instances of a certain element in an HTML document?​

User Koorchik
by
4.4k points

1 Answer

6 votes

Answer:

"getElementsByTagName()" is the correct answer for the above question.

Step-by-step explanation:

  • The above-defined function is a javascript function, which is used to give the references for any element. The element can access by the help of the tag name.
  • The above function matches the specified argument tag with all the tag in the HTML document and catches that element which matches fits.
  • Just for example if a html elemnt holds a list ement which is written in html as <li>, then the above defined function can call its by the help of "getElementsByTagName("li")".
  • The above question asked about a method that is used to reference any element of the HTML. Hence getElementsByTagName() is the correct answer.
User Maikel Willemse
by
4.4k points