Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Non type:submit input/button
Browse files Browse the repository at this point in the history
Add trigger for non type:submit input/button
  • Loading branch information
alexalouit committed Jul 12, 2015
1 parent 1c73a7a commit 1e2425b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@

Validator.prototype.toggleSubmit = function () {
if(!this.options.disable) return
var $btn = $('button[type="submit"], input[type="submit"]')
var $btn = $('button[type="submit"], [data-validator="submit"], input[type="submit"]')
.filter('[form="' + this.$element.attr('id') + '"]')
.add(this.$element.find('input[type="submit"], button[type="submit"]'))
.add(this.$element.find('input[type="submit"], button[type="submit"], [data-validator="submit"]'))
$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
.css({'pointer-events': 'all', 'cursor': 'pointer'})
}
Expand Down Expand Up @@ -252,7 +252,7 @@
.html(originalContent)
})

this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled')
this.$element.find('input[type="submit"], button[type="submit"], [data-validator="submit"]').removeClass('disabled')

this.$element.find('.has-error').removeClass('has-error')

Expand Down
2 changes: 1 addition & 1 deletion dist/validator.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions js/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@

Validator.prototype.toggleSubmit = function () {
if(!this.options.disable) return
var $btn = $('button[type="submit"], input[type="submit"]')
var $btn = $('button[type="submit"], [data-validator="submit"], input[type="submit"]')
.filter('[form="' + this.$element.attr('id') + '"]')
.add(this.$element.find('input[type="submit"], button[type="submit"]'))
.add(this.$element.find('input[type="submit"], button[type="submit"], [data-validator="submit"]'))
$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
.css({'pointer-events': 'all', 'cursor': 'pointer'})
}
Expand Down Expand Up @@ -272,7 +272,7 @@
.html(originalContent)
})

this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled')
this.$element.find('input[type="submit"], button[type="submit"], [data-validator="submit"]').removeClass('disabled')

this.$element.find('.has-error').removeClass('has-error')

Expand Down

0 comments on commit 1e2425b

Please sign in to comment.