Skip to content

Commit 6aefeed

Browse files
author
ehynds
committed
Merge branch 'master' of github.com:ehynds/jquery-ui-multiselect-widget
2 parents f90a1e5 + 6c1385c commit 6aefeed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/jquery.multiselect.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
hide: null,
4141
autoOpen: false,
4242
multiple: true,
43-
position: {}
43+
position: {},
44+
appendTo: document.body
4445
},
4546

4647
_create: function() {
@@ -68,7 +69,7 @@
6869
menu = (this.menu = $('<div />'))
6970
.addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all')
7071
.addClass(o.classes)
71-
.appendTo(document.body),
72+
.appendTo(o.appendTo),
7273

7374
header = (this.header = $('<div />'))
7475
.addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix')
@@ -578,10 +579,10 @@
578579
// show the menu, maybe with a speed/effect combo
579580
$.fn.show.apply(menu, args);
580581

581-
// select the first option
582+
// select the first not disabled option
582583
// triggering both mouseover and mouseover because 1.4.2+ has a bug where triggering mouseover
583584
// will actually trigger mouseenter. the mouseenter trigger is there for when it's eventually fixed
584-
this.labels.eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');
585+
this.labels.filter(':not(.ui-state-disabled)').eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');
585586

586587
button.addClass('ui-state-active');
587588
this._isOpen = true;

0 commit comments

Comments
 (0)