|
1 | 1 | /*! |
2 | | - * Validator v0.11.0 for Bootstrap 3, by @1000hz |
| 2 | + * Validator v0.11.1 for Bootstrap 3, by @1000hz |
3 | 3 | * Copyright 2016 Cina Saffary |
4 | 4 | * Licensed under http://opensource.org/licenses/MIT |
5 | 5 | * |
|
30 | 30 |
|
31 | 31 | this.$element.on('input.bs.validator change.bs.validator focusout.bs.validator', $.proxy(this.onInput, this)) |
32 | 32 | this.$element.on('submit.bs.validator', $.proxy(this.onSubmit, this)) |
| 33 | + this.$element.on('reset.bs.validator', $.proxy(this.onReset, this)) |
33 | 34 |
|
34 | 35 | this.$element.find('[data-match]').each(function () { |
35 | 36 | var $this = $(this) |
|
46 | 47 | this.toggleSubmit() |
47 | 48 | } |
48 | 49 |
|
49 | | - Validator.VERSION = '0.11.0' |
| 50 | + Validator.VERSION = '0.11.1' |
50 | 51 |
|
51 | 52 | Validator.INPUT_SELECTOR = ':input:not([type="hidden"], [type="submit"], button)' |
52 | 53 |
|
|
283 | 284 | this.$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors()) |
284 | 285 | } |
285 | 286 |
|
| 287 | + Validator.prototype.onReset = function (e) { |
| 288 | + var self = this |
| 289 | + var options = this.options |
| 290 | + |
| 291 | + window.setTimeout(function () { |
| 292 | + self.destroy() |
| 293 | + Plugin.call(self.$element, options) |
| 294 | + }, 0) |
| 295 | + } |
| 296 | + |
286 | 297 | Validator.prototype.defer = function ($el, callback) { |
287 | 298 | callback = $.proxy(callback, this, $el) |
288 | 299 | if (!this.options.delay) return callback() |
|
318 | 329 |
|
319 | 330 | this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled') |
320 | 331 |
|
321 | | - this.$element.find('.has-error, .has-danger').removeClass('has-error has-danger') |
| 332 | + this.$element.find('.has-error, .has-danger, .has-success').removeClass('has-error has-danger has-success') |
322 | 333 |
|
323 | 334 | return this |
324 | 335 | } |
|
0 commit comments