Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Basic form validation
- $('form[novalidate]').on('submit', function(event){
- $('.form-control', this).each(function(){
- if (this.checkValidity() == false || ($(this).attr('data-match') && $(this).val() != $('#' + $(this).attr('data-match')).val())) {
- event.preventDefault();
- event.stopPropagation();
- $(this).parents('.form-group').addClass('has-error');
- }
- else {
- $(this).parents('.form-group').removeClass('has-error');
- }
- });
- });
- //Dirty input
- $('.form-control').on('focusout', function(){
- if (this.checkValidity() != false) {
- $(this).parents('.form-group').removeClass('has-error');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement