summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouis cuny <louiscuny@gmail.com>2016-11-22 12:17:32 +0100
committerGitHub <noreply@github.com>2016-11-22 12:17:32 +0100
commite0522118f1de1eed4db642d485a158a259fe265a (patch)
tree98ecadbf5e9426aab7a2b19a2454fce926b7eafb
parentbc93593cfea2bf40cc26cc6680c740d982ecf816 (diff)
parent4083c0ee9f22b1fcf87e76cdef254a96ed0748c8 (diff)
downloadmulti-select-origin/master.zip
multi-select-origin/master.tar.gz
multi-select-origin/master.tar.bz2
Merge pull request #251 from solidmoose/masterHEADorigin/masterorigin/HEADmaster
Fix addOption when 'nested' specified
-rw-r--r--js/jquery.multi-select.js4
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);