Skip to content

Commit

Permalink
Fix #740 Group label inside an li tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Harris authored and mlh758 committed Feb 3, 2018
1 parent 5f55116 commit 44624c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/jquery.multiselect.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
// show/hide optgroups
$groups.each(function() {
var $this = $(this);
if (!$this.children('li').filter(':visible').length)
if (!$this.children('ul').children('li').filter(':visible').length)
$this.hide();
});
this.instance._setMenuHeight();
Expand Down
19 changes: 11 additions & 8 deletions src/jquery.multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,16 @@
});

// Build the list section for this optgroup, complete w/ option inputs...
var $optionGroup = $( document.createElement('ul') )
.addClass('ui-multiselect-optgroup'
+ (self.options.groupColumns ? ' ui-multiselect-columns' : '')
+ (elem.className && ' ') + elem.className)
.append( $( document.createElement('a') ).text( elem.getAttribute('label') ), options);

list.push($optionGroup);
var $optGroupItem = $( document.createElement('li') )
.addClass('ui-multiselect-optgroup'
+ (self.options.groupColumns ? ' ui-multiselect-columns' : '')
+ (elem.className && ' ') + elem.className)
.append( $( document.createElement('a') )
.text( elem.getAttribute('label') ) );
var $optionGroup = $( document.createElement('ul') ).append(options)
$optGroupItem.append($optionGroup)

list.push($optGroupItem);
}
else {
list.push(self._makeOption(elem));
Expand Down Expand Up @@ -474,7 +477,7 @@
e.preventDefault();

var $this = $(this);
var $inputs = $this.parent().find('input').filter(':visible:not(:disabled)');
var $inputs = $this.parent().find('ul input').filter(':visible:not(:disabled)');
var nodes = $inputs.get();
var label = this.textContent;

Expand Down

0 comments on commit 44624c0

Please sign in to comment.