.uniqueId()

.uniqueId()

.uniqueId()Returns: jQuery

Description: Generate and apply a unique id for the set of matched elements.

  • version added: 1.9.uniqueId()

    • This method does not accept any arguments.

Many widgets need to generate unique ids for elements. .uniqueId() will check if the element has an id, and if not, it will generate one and set it on the element. It is safe to call .uniqueId() on an element without checking if it already has an id. If/when the widget needs to clean up after itself, the -removeUniqueId() method will remove the id from the element if it was added by -uniqueId() and leave the id alone if it was not- -removeUniqueId() is able to be smart about this because the generated ids have a prefix of .html?lang=en"ui-id-".

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jqueryui.com/uniqueId

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部