我在简单的表单上使用jquery寻找验证,我想知道如何检查字母数字或数字。然后我想使用规则突出显示错误文本字段。这个代码工作得很好,在字段中输入了,任何人都可以帮助我将这个功能添加到我的代码中吗?
这是我用过的代码
$("#frmstudent").validate({
rules:{
txt_name :{ required:true, minlength : 3 },
txt_fname:{ required:true, minlength : 3 },
txt_class:{ required:true, minlength: 2 },
txt_city:{ required:true, minlength : 3},
txt_contact:{ required:true, minlength : 5 },
txt_email:{ required:true, email:true, minlength : 8},
txt_address:{ required:true , minlength : 10}
},
messages:{
txt_name:{required:"<i>Please enter ur full name</i>",
minlength:"<i>please enter at least 3 characters</i>"},
txt_fname:{required:"<i>Please enter the fathers name in required field</i>",
minlength:"<i>please enter at least 3 characters</i>"},
txt_class:{required:"<i>Please enter the your class name</i>",
minlength:"<i>please enter at least 2 characters</i>"},
txt_city:{required:"<i>Please enter your city name</i>",
minlength:"<i>please enter at least 3 characters</i>"},
txt_contact:{required:"<i>Please enter your contact details</i>",
minlength:"<i>please enter at least 5 characters</i>"},
txt_email:{required:"<i>Please enter your valid email address</i>",
minlength:"<i>please enter at least 8 characters</i>"},
txt_address:{required:"<i>Please enter your address</i>",
minlength:"<i>please enter at least 10 characters</i>"}
}
});