Skip to content

Commit

Permalink
allow form.reset() to work out-of-the-box (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol committed Apr 17, 2020
1 parent 1092779 commit 000a334
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@

init: function () {
var that = this,
id = this.$element.attr('id');
id = this.$element.attr('id'),
form = this.$element[0].form;

selectId++;
this.selectId = 'bs-select-' + selectId;
Expand Down Expand Up @@ -1005,6 +1006,14 @@
});
}

if (form) {
$(form).on('reset' + EVENT_KEY, function () {
requestAnimationFrame(function () {
that.render();
});
});
}

setTimeout(function () {
that.buildList();
that.$element.trigger('loaded' + EVENT_KEY);
Expand Down

0 comments on commit 000a334

Please sign in to comment.