user3500393
user3500393

Reputation: 1

jQuery validations are not working on IE10

Here I am using validation on form. It works on Chrome, Firefox but gives the problem in IE10. Some of the validations are not working like email, telephone. And this problem is on all the html pages.

$('#contact').validate({
    onfocusout: function (element) {
        $(element).valid();
    },
    rules:{
        prenume:{
            required:true,
        },
        nume:{
            required:true,
        },
        email:{
            required:true,
            email:true
        },
        password_new:{
            required:true,
        },
        telefon:{
            required:true,
        },
        address:{
            required:true,

        },
        password_repeat:{
            required:true,
        }
    },

    messages:{
        prenume:{
            required:'<div style="color:red; padding-left:0px;" >Acest c&#xE2;mp este obligatoriu.</div>',
        },
        nume:{
            required:'',
        },
        email:{
            required:'<div style="color:red; padding-left:0px;">Acest c&#xE2;mp este obligatoriu.</div>',
            email:'<div style="color:red; padding-left:0px;">Adres&#xE2; de e-mail incorect&#xE2;.</div>',
        },
        password_new:{
            required:'<div style="color:red; padding-left:0px;">Acest c&#xE2;mp este obligatoriu.</div>',
        },
        telefon:{
            required:'<div style="color:red; padding-left:0px;">Acest c&#xE2;mp este obligatoriu.</div>',
        },
        password_repeat:{
            required:'',
        }
    }
});

Upvotes: 0

Views: 52

Answers (2)

Girish
Girish

Reputation: 12117

IE is syntax strict browser, please care about extra comma(,)

password_repeat:{
  required: '',
}

To

password_repeat:{
  required: ''
}

Upvotes: 1

4dgaurav
4dgaurav

Reputation: 11506

@Girish solution would solve the problem and for compatibility mode in IE10 to IE8 = it returns an empty string even if ah attribute doesn't exist. So

 $(event.target).attr("formnovalidate") !== undefined

is always true and the validation is skipped forked the jQuery validation plugin and fixed it, here is the fix

Upvotes: 0

Related Questions