Easy Tutorial
❮ Api Toggle Api Sortable ❯

jQuery UI API - .uniqueId()

Category

Methods | UI Core

Usage

Description: Generates and applies a unique ID to the set of matched elements.

Returns: jQuery

Version Added: 1.9

This method does not accept any parameters.

Many widgets require elements to have a unique ID. .uniqueId() checks if the element has an ID, and if it does not, it generates an ID and sets it as the element's ID. It is safe to call .uniqueId() without checking if the element already has an ID. When the widget needs to be cleaned up, if the ID was added by .uniqueId(), the `method will remove the ID from the element. If the ID was not added by.uniqueId(), it will have no effect..removeUniqueId()can distinguish IDs because.uniqueId()generates IDs with the prefix"ui-id-"`.

❮ Api Toggle Api Sortable ❯