Using The id Attribute in JavaScript


« Previous Next »

The id attribute can also be used by JavaScript to perform some tasks for that specific element.

JavaScript can access an element with a specific id with the getElementById() method:







Live Demo & Try it yourself!