getElementById is an essential method commonly used in JavaScript in the browser to retrieve a particular element node in a HTML or XML document by its ID.
Description
getElementById
is an essential method commonly used in JavaScript in the browser to retrieve a particular element node in a HTML or XML document by its ID.
Syntax
element = document.getElementById(id);
where,
- element is a reference to an Element object, or null if an element with the specified ID is not in the document.
- id is a case-sensitive string representing the unique ID of the element being sought.