What is the purpose of the "document.getElementById()" function in JavaScript?
-
A
Accessing a specific HTML element by its ID
Correct answer
-
B
Creating a new HTML element
-
C
Modifying the entire HTML document
-
D
Deleting HTML elements
Correct answer
A. Accessing a specific HTML element by its ID
17 views
Explanation
This function allows developers to access a specific HTML element by its unique ID, facilitating dynamic manipulation of the content.
Video explanation
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ