Selecting DOM elements

Qus. 1 : Which method is used to find an HTML element by its ID?

  1. getElementByTagName()
  2. getElementById()
  3. getElementByClass()
  4. querySelector()
Qus. 2 : How can you access all elements with a specific class name?

  1. document.getElementByClassName()
  2. document.getElementsByClassName()
  3. document.querySelectorAll(".class")
  4. Both b and c
Qus. 3 : How can you retrieve all the child elements of a specific DOM node?

  1. element.getChildren()
  2. element.childNodes
  3. element.getElementsByTagName()
  4. element.getChildNodes()
Qus. 4 : How can you access an element by its tag name in JavaScript?

  1. document.getElementByTagName()
  2. document.getElementsByTagName()
  3. document.querySelectorAll()
  4. document.tagName()

Programs

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad