A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/html/attributes/id below:

id · WebPlatform Docs

id Summary

The id attribute is used for identifying elements in a document.

Applies to ?

## Examples

This example gets the ID attribute of each cell of a table. When the user clicks a cell, the object of the cell is passed to a function which returns the object’s ID.

<script>
function getID(oObject)
{
    var id = oObject.id;
    alert("This object's ID attribute is set to \"" + id + "\".");
}
</script>
<table border="">
    <tr>
        <td id="firstCell" onclick="getID(this);">Table Cell 1</td>
        <td id="secondCell" onclick="getID(this);">Table Cell 2</td>
        <td id="thirdCell" onclick="getID(this);">Table Cell 3</td>
    </tr>
</table>

View live example

Notes Remarks

The id is an SGML identifier used as the target for hypertext links or for naming particular objects in associated style sheets. The id should be unique throughout the scope of the current document. If a document contains more than one object with the same identifier, the objects are exposed as a collection that can be referenced only in ordinal position. In versions earlier than Microsoft Internet Explorer 5, this property is read-only.

Syntax See also Related pages Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4