DOM:element.id
From MDC
Contents |
[edit] Summary
Gets or sets the element's identifier.
[edit] Syntax
idStr = element.id element.id = idStr
where idStr is the ID of the element.
[edit] Notes
The ID must be unique in a document, and is often used to retrieve the element using document.getElementById.
In some documents (in particular, HTML, XUL, and SVG), the id of an element can be specified as an attribute on the element like so: <div id="table-cell2">.
However you can't use this attribute in a custom XML document without correctly specifying the type of the id attribute in the DOCTYPE. See getElementById Pitfalls for details.
Other common usages of id include using the element's ID as a selector when styling the document with CSS.