diff options
-rw-r--r-- | js/jquery.multi-select.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index 653aa07..d71ca10 100644 --- a/js/jquery.multi-select.js +++ b/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); |