You are here: Reference > JavaScript > client-side > HTML DOM > properties > uniqueID

uniqueID property

Browser support:
Returns the unique identifier generated by the browser for the object.
The uniqueID property of the document works as an identifier generator in Internet Explorer. Each time when the value of this uniqueID property is retrieved, the browser generates a new unique identifier and returns it.
HTML elements also support the uniqueID property. The first time when the value of any of these properties is retrieved, the browser generates a new identifier for the element.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the unique identifier.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the uniqueID property:
    <script type="text/javascript">
        function GenerateIDs () {
            var message = "The generated ids:";
            for (var i = 0; i < 5; i++) {
                message += "\n" + document.uniqueID;

            alert (message);
    <button onclick="GenerateIDs ()">Get five unique identifiers!</button>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content