summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouis cuny <louiscuny@gmail.com>2016-11-22 12:16:47 +0100
committerGitHub <noreply@github.com>2016-11-22 12:16:47 +0100
commitbc93593cfea2bf40cc26cc6680c740d982ecf816 (patch)
tree267615d8129f2931ebb0db270ad0ec88b5e9e465
parent7a5354c2bcec3832c688bf8ee175b650c46a4ab9 (diff)
parent548e666ea5c7c7e763a19c6ad90712b6ae113f57 (diff)
downloadmulti-select-bc93593cfea2bf40cc26cc6680c740d982ecf816.zip
multi-select-bc93593cfea2bf40cc26cc6680c740d982ecf816.tar.gz
multi-select-bc93593cfea2bf40cc26cc6680c740d982ecf816.tar.bz2
Merge pull request #255 from Westwing-Home-and-Living/master
Add `optionClass` and `disabled` options to addOption method
-rw-r--r--js/jquery.multi-select.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js
index fb478f5..653aa07 100644
--- a/js/jquery.multi-select.js
+++ b/js/jquery.multi-select.js
@@ -184,6 +184,14 @@
index = parseInt((typeof option.index === 'undefined' ? that.$element.children().length : option.index)),
$container = option.nested === undefined ? that.$element : $("optgroup[label='"+option.nested+"']");
+ if (option.optionClass) {
+ $option.addClass(option.optionClass);
+ }
+
+ if (option.disabled) {
+ $option.prop('disabled', true);
+ }
+
$option.insertAt(index, $container);
that.generateLisFromOption($option.get(0), index, option.nested);
}