Permalink
Browse files

Merge pull request #251 from solidmoose/master

Fix addOption when 'nested' specified
  • Loading branch information...
2 parents bc93593 + 4083c0e commit e0522118f1de1eed4db642d485a158a259fe265a @lou committed on GitHub Nov 22, 2016
Showing with 2 additions and 2 deletions.
  1. +2 −2 js/jquery.multi-select.js
@@ -181,8 +181,8 @@
if (option.value !== undefined && option.value !== null &&
that.$element.find("option[value='"+option.value+"']").length === 0){
var $option = $('<option value="'+option.value+'">'+option.text+'</option>'),
- index = parseInt((typeof option.index === 'undefined' ? that.$element.children().length : option.index)),
- $container = option.nested === undefined ? that.$element : $("optgroup[label='"+option.nested+"']");
+ $container = option.nested === undefined ? that.$element : $("optgroup[label='"+option.nested+"']"),
+ index = parseInt((typeof option.index === 'undefined' ? $container.children().length : option.index));
if (option.optionClass) {
$option.addClass(option.optionClass);

0 comments on commit e052211

Please sign in to comment.