Skip to content

Commit 98f68ac

Browse files
committed
Fix #651
Title attribute for the label should not have been getting set to the text content of the option element automatically like it was. This was initially done to give a text value to the click event ui object. The correct route for a fix should have been to look at the span for the text value to pass when the event fires rather than always storing it in the title. This is now being done.
1 parent c17a503 commit 98f68ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/jquery.multiselect.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
var $this = $(this);
150150
var parent = this.parentNode;
151151
var description = this.innerHTML;
152-
var title = this.title === "" ? this.textContent : this.title;
152+
var title = this.title;
153153
var value = this.value;
154154
var inputID = 'ui-multiselect-' + multiselectID + '-' + (this.id || id + '-option-' + i);
155155
var isDisabled = this.disabled;
@@ -375,11 +375,12 @@
375375
.delegate('input[type="checkbox"], input[type="radio"]', 'click.multiselect', function(e) {
376376
var $this = $(this);
377377
var val = this.value;
378+
var optionText = $this.parent().find("span").text();
378379
var checked = this.checked;
379380
var tags = self.element.find('option');
380381

381382
// bail if this input is disabled or the event is cancelled
382-
if(this.disabled || self._trigger('click', e, { value: val, text: this.title, checked: checked }) === false) {
383+
if(this.disabled || self._trigger('click', e, { value: val, text: optionText, checked: checked }) === false) {
383384
e.preventDefault();
384385
return;
385386
}

0 commit comments

Comments
 (0)