Skip to content

Commit 7932007

Browse files
committed
fixed: improved unique ID generation
1 parent aa692bb commit 7932007

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ $.widget("ui.selectmenu", {
2828

2929
_create: function() {
3030
var self = this, o = this.options;
31-
32-
// set a default id value, generate a new random one if not set by developer
33-
var selectmenuId = ( this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ) ).replace( /(:|\.)/g, '' )
31+
32+
// make / set unique id
33+
var selectmenuId = this.element.uniqueId().attr( "id" );
3434

3535
// quick array of button and menu id's
3636
this.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ];
37-
37+
3838
// define safe mouseup for future toggling
3939
this._safemouseup = true;
4040
this.isOpen = false;

0 commit comments

Comments
 (0)