summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwenzhixin <wenzhixin2010@gmail.com>2015-12-01 22:05:58 +0800
committerwenzhixin <wenzhixin2010@gmail.com>2015-12-01 22:05:58 +0800
commitfa9c8c94fb7a9f04792c4b0db819c0f6b72826e9 (patch)
tree883186481d752f48486214314bc69d46df193ff3
parent17557b6d9ddbbe753fe231ad60c5466340d39c29 (diff)
parentf5dc4cd866ba9a9775dd48b47edd5ad1bce451ce (diff)
downloadmultiple-select-fa9c8c94fb7a9f04792c4b0db819c0f6b72826e9.zip
multiple-select-fa9c8c94fb7a9f04792c4b0db819c0f6b72826e9.tar.gz
multiple-select-fa9c8c94fb7a9f04792c4b0db819c0f6b72826e9.tar.bz2
Merge pull request #258 from salavessa/master
Fix #257: <label> element detection
-rw-r--r--multiple-select.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/multiple-select.js b/multiple-select.js
index 600d73c..25cb16a 100644
--- a/multiple-select.js
+++ b/multiple-select.js
@@ -37,8 +37,10 @@
this.$el = $el.hide();
// label element
- this.$label = this.$el.closest('label') ||
- this.$el.attr('id') && $(sprintf('label[for="%s"]', this.$el.attr('id').replace(/:/g, '\\:')));
+ this.$label = this.$el.closest('label');
+ if (this.$label.length === 0 && this.$el.attr('id')) {
+ this.$label = $(sprintf('label[for="%s"]', this.$el.attr('id').replace(/:/g, '\\:')));
+ }
// restore class and title from select element
this.$parent = $(sprintf(