jQuery UI API - .uniqueId()
Category
Usage
Description:Generate and apply a unique id for the set of matched elements.
Returns:jQuery
Version added:1.9
.uniqueId()
This method does not accept any arguments.
Many widgets require elements to have a unique id..uniqueId()It checks whether the element has an id. If the element does not have an id, it will generate one and set it as the element's id. Calling it without checking whether the element has an id.uniqueId()is safe. When the widget needs to be cleaned up after use, if the id was added via.uniqueId()added,.removeUniqueId()the method will remove the id from the element; if the id was not added via.uniqueId()added, it has no effect..removeUniqueId()The reason the id can be distinguished is that.uniqueId()the generated id carries a prefix"ui-id-"。