Skip to content

Commit 1eb136f

Browse files
author
Michael
committed
Fix #682 Update now returns undefined
Setting default value with a flag within the method now instead of with return value.
1 parent 4e047ea commit 1eb136f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/jquery.multiselect.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@
249249

250250
this._setButtonWidth();
251251

252-
// remember default value
253-
this.button[0].defaultValue = this.update();
252+
this.update(true);
254253

255254
// broadcast refresh event; useful for widgets
256255
if(!init) {
@@ -259,7 +258,7 @@
259258
},
260259

261260
// updates the button text. call refresh() to rebuild
262-
update: function() {
261+
update: function(isDefault) {
263262
var o = this.options;
264263
var $inputs = this.inputs;
265264
var $checked = $inputs.filter(':checked');
@@ -279,8 +278,10 @@
279278
}
280279

281280
this._setButtonValue(value);
281+
if(isDefault) {
282+
this.button[0].defaultValue = value;
283+
}
282284

283-
return value;
284285
},
285286

286287
// this exists as a separate method so that the developer
@@ -941,7 +942,7 @@
941942
break;
942943
case 'selectedListSeparator':
943944
this.options[key] = value;
944-
this.button[0].defaultValue = this.update();
945+
this.update(true);
945946
break;
946947
}
947948

tests/unit/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
equals(matched.length, 8, "The 9 selected values are joined by <br> tags");
369369
el.multiselect("option", "selectedListSeparator", ", ");
370370
text = $(button()).text();
371-
matched = text.match(/\,/g)
371+
matched = text.match(/\,/g);
372372
equals(matched.length, 8, "The 9 selected values are joined by commas again after calling the option method");
373373
el.multiselect("destroy");
374374
});

0 commit comments

Comments
 (0)