{"id":106,"date":"2023-08-25T17:43:41","date_gmt":"2023-08-25T17:43:41","guid":{"rendered":"\/\/api.jqueryui.com\/1.9\/?p=106"},"modified":"2023-08-25T17:43:41","modified_gmt":"2023-08-25T17:43:41","slug":"uniqueId","status":"publish","type":"post","link":"https:\/\/api.jqueryui.com\/1.9\/uniqueId\/","title":{"rendered":".uniqueId()"},"content":{"rendered":"<article id=\"uniqueId1\" class=\"entry method\"><h2 class=\"section-title\">\n<span class=\"name\">.uniqueId()<\/span><span class=\"returns\">Returns: <a href=\"http:\/\/api.jquery.com\/Types\/#jQuery\">jQuery<\/a><\/span>\n<\/h2>\n<div class=\"entry-wrapper\">\n<p class=\"desc\"><strong>Description: <\/strong>Generate and apply a unique id for the set of matched elements.<\/p>\n<ul class=\"signatures\"><li class=\"signature\">\n<h4 class=\"name\">\n<span class=\"version-details\">version added: 1.9<\/span><a id=\"uniqueId\" href=\"#uniqueId\"><span class=\"icon-link\"><\/span>.uniqueId()<\/a>\n<\/h4>\n<ul><li><div class=\"null-signature\">This method does not accept any arguments.<\/div><\/li><\/ul>\n<\/li><\/ul>\n<div class=\"longdesc\" id=\"entry-longdesc\">\n\t\t<p>Many widgets need to generate unique ids for elements. <code>.uniqueId()<\/code> 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 <code>.uniqueId()<\/code> on an element without checking if it already has an id. If\/when the widget needs to clean up after itself, the <a href=\"\/1.9\/removeUniqueId\/\"><code>.removeUniqueId()<\/code><\/a> method will remove the id from the element if it was added by <code>.uniqueId()<\/code> and leave the id alone if it was not. <code>.removeUniqueId()<\/code> is able to be smart about this because the generated ids have a prefix of <code>&quot;ui-id-&quot;<\/code>.<\/p>\n\t<\/div>\n<\/div><\/article>","protected":false},"excerpt":{"rendered":"<p>Generate and apply a unique id for the set of matched elements.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,9],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","hentry","category-methods","category-ui-core"],"_links":{"self":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":1,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/posts\/106\/revisions\/107"}],"wp:attachment":[{"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/api.jqueryui.com\/1.9\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}