Use the id attribute in HTML to add a unique identifier for an element.
You can try running the following code to implement the id attribute−
<html> <body> <h1>Tutorialspoint</h1> <p id = "myid">We provide Tutorials!</p> <button onclick = "display()">More...</button> <script> function display() { document.getElementById("myid").innerHTML = "We provide learning videos as well"; } </script> </body> </html>
The above is the detailed content of How to add a unique identifier to an element in HTML?. For more information, please follow other related articles on the PHP Chinese website!