Vidyalelo
JavaScript · Q60

Server

Programming · JavaScript · question 60

Q60

How to pick a document element based on the value of its id attribute?

A.
getElementsbyId()
B.
getElementbyId()
Answer
C.
both getElementsbyId() and getElementbyId()
D.
none of the mentioned

Answer: Option B

Solution

Answer: Option B
Solution:
The Document object has important methods such as getElementById(), which returns a single document element (representing an open/close pair of HTML tags and all of the content between them) based on the value of its id attribute.