/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: id

[this page | pdf | back links]

The HTML id attribute indicates the unique id (identifier) for an element.

 

Valid attribute values include:

 

Value

Description

text

Unique id (identifier)

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<a href="http://www.nematrian.com">link to www.nematrian.com</a>
<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("A");
x.href = "http://www.nematrian.com";
x.textContent = "link to www.nematrian.com";
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile