Home »
MCQs »
JavaScript MCQs
Which JavaScript method is used to access an HTML element by id?
9. Which JavaScript method is used to access an HTML element by id?
- getElementById()
- getElement(id)
- getElementById(id)
- elementById(id)
Answer: C) getElementById(id)
Explanation:
The JavaScript method document.getElementById(id) is used to access an HTML document by id.