summaryrefslogtreecommitdiffstats
path: root/multiple-select.js
diff options
context:
space:
mode:
authorJoão <joao.salavessa@sky.uk>2015-12-01 14:00:50 +0000
committerJoão <joao.salavessa@sky.uk>2015-12-01 14:00:50 +0000
commitf5dc4cd866ba9a9775dd48b47edd5ad1bce451ce (patch)
tree883186481d752f48486214314bc69d46df193ff3 /multiple-select.js
parent17557b6d9ddbbe753fe231ad60c5466340d39c29 (diff)
downloadmultiple-select-f5dc4cd866ba9a9775dd48b47edd5ad1bce451ce.zip
multiple-select-f5dc4cd866ba9a9775dd48b47edd5ad1bce451ce.tar.gz
multiple-select-f5dc4cd866ba9a9775dd48b47edd5ad1bce451ce.tar.bz2
Fix #257: <label> element detection
Diffstat (limited to 'multiple-select.js')
-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(