

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to specify a unique id for an element in HTML?
Use the id attribute in HTML to specify a unique id for an element in HTML.
Example
You can try to run 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>
- Related Questions & Answers
- How to add a unique id for an element in HTML?
- How to specify the type of box used for an HTML element using CSS?
- How to specify that an element is not yet relevant in HTML?
- How to create a unique ID for each object in JavaScript?
- How to specify that the element is read-only in HTML?
- How to specify which form element a calculation is bound to with HTML?
- How to access unique Android device ID?
- How to specify a minimum value in HTML?
- How to specify citation in HTML?
- How to specify whether the content of an element should be translated or not in HTML?
- How to generate Unique ID of device for iPhone/iPad using Swift?
- How to use inline CSS style for an element in HTML?
- Adding a unique id for each entry in JSON object in JavaScript
- How to specify an image as a client-side image-map in HTML?
- How to specify the usage of an element using the tabbing order (tab keyboard button) in HTML?
Advertisements