![]() |
Definition and UsageThe The Browser SupportSyntax
Attribute Values
|
Example:
HTML
<!DOCTYPE HTML>
<html>
<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="displayResult()">Change text</button>
<script>
function displayResult() {
document.getElementById("myHeader").innerHTML = "Have a nice day!";
}
</script>
</body>
</html>
Example:
HTML
<html>
<body>
<h2><a id="top">Some heading</a></h2>
<p>Lots of text....</p>
<p>Lots of text....</p>
<p>Lots of text....</p>
<a href="#top">Go to top</a>
</body>
</html>
Example:
HTML
<!DOCTYPE HTML>
<html>
<head>
<style>
#myHeader {
color: red;
text-align: center;
}
</style>
</head>
<body>
<h1 id="myHeader">Horje is the best!</h1>
</body>
</html>
html id attribute |
HTML accesskey Attribute | HTML Global Attributes |
HTML class Attribute | HTML Global Attributes |
HTML contenteditable Attribute | HTML Global Attributes |
HTML data-* Attributes | HTML Global Attributes |
HTML dir Attribute | HTML Global Attributes |
HTML draggable Attribute | HTML Global Attributes |
HTML enterkeyhint Attribute | HTML Global Attributes |
HTML hidden Attribute | HTML Global Attributes |
HTML id Attribute | HTML Global Attributes |
HTML inert Attribute | HTML Global Attributes |
HTML inputmode Attribute | HTML Global Attributes |
HTML lang Attribute | HTML Global Attributes |
HTML popover Attribute | HTML Global Attributes |
HTML spellcheck Attribute | HTML Global Attributes |
HTML style Attribute | HTML Global Attributes |
HTML tabindex Attribute | HTML Global Attributes |
HTML title Attribute | HTML Global Attributes |
HTML translate Attribute | HTML Global Attributes |
HTML Global Attributes | HTML Global Attributes |
How to Use the id attribute to manipulate text with JavaScript | HTML Global Attributes |
How to Use the id attribute to link to an element with a specified id within a page | HTML Global Attributes |
How to Use the id attribute to style text with CSS | HTML Global Attributes |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Global Attributes |
Uploaded by: | Admin |
Reffered: https://www.w3schools.com/tags/att_global_id.asp