summaryrefslogtreecommitdiffstats
path: root/multiple-select.js
diff options
context:
space:
mode:
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(