summaryrefslogtreecommitdiffstats
path: root/js/jquery.multi-select.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/jquery.multi-select.js')
-rw-r--r--js/jquery.multi-select.js12
1 files changed, 1 insertions, 11 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js
index c653dd3..488b9ca 100644
--- a/js/jquery.multi-select.js
+++ b/js/jquery.multi-select.js
@@ -182,17 +182,7 @@
that.$element.find("option[value='"+option.value+"']").length === 0){
var $option = $('<option value="'+option.value+'">'+option.text+'</option>'),
$container = option.nested === undefined ? that.$element : $("optgroup[label='"+option.nested+"']"),
- index;
-
- if(typeof option.index === 'undefined'){
- if(typeof option.nested !== 'undefined' && option.nested !== null){
- index = that.$element.children('[label="' + option.nested + '"]').children().length;
- } else {
- index = that.$element.children().length;
- }
- } else {
- index = parseInt(option.index);
- }
+ index = parseInt((typeof option.index === 'undefined' ? $container.children().length : option.index));
$option.insertAt(index, $container);
that.generateLisFromOption($option.get(0), index, option.nested);