76.4k views
1 vote
State one similiarity between the returned value of getElementsByTagName() and getElementsByClass()

1 Answer

7 votes

Answer:

The return type of both the methods is a Live HTMLCollection.

Step-by-step explanation:

  • Both the methods getElementsByClassName() and getElementsByTagName() returns a Live HTMLCollection.
  • Both the methods result in the collection of elements according to the method name.
  • The method getElementsByClassName() results in the elements with the given class name.
  • The method getElementsByTagName() results in the elements with the given Tag name.
  • As stated above both the methods returns HTMLCollection which are live. That means the methods take care of the changing tag names and class names.
  • If there are any updates to the class names and tag names, the list gets updated accordingly.
User CuriousGeorge
by
4.9k points