jquery validate在IE7无效的问题,其他浏览器正常验证
<scripttype="text/javascript"src='./script/jquery-1.9.1.min.js'></script><scripttype=...
<script type="text/javascript" src='./script/jquery-1.9.1.min.js'></script>
<script type="text/javascript" src='./script/jquery.validate.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
$('#form1').validate({
submitHandler:function(){
$.ajax({
type:'post',
url:'test.php',
data:$('#form1').serialize(),
dataType:'json',
success:function(data){
alert('你的用户名:'+data.username+"\n密码为:"+data.password);
}
});
},
rules:{
username:{
required:true
}
},
messages:{
username:{
required:'必填'
}
}
})
})
</script>
</head>
<body>
<form id='form1' name='form1' method="post">
<input type='text' name='username' id='username' /><br/>
<input type="password" name="password" id='password' /><br/>
<input type='submit' value='提交'/>
</form>
</body> 展开
<script type="text/javascript" src='./script/jquery.validate.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
$('#form1').validate({
submitHandler:function(){
$.ajax({
type:'post',
url:'test.php',
data:$('#form1').serialize(),
dataType:'json',
success:function(data){
alert('你的用户名:'+data.username+"\n密码为:"+data.password);
}
});
},
rules:{
username:{
required:true
}
},
messages:{
username:{
required:'必填'
}
}
})
})
</script>
</head>
<body>
<form id='form1' name='form1' method="post">
<input type='text' name='username' id='username' /><br/>
<input type="password" name="password" id='password' /><br/>
<input type='submit' value='提交'/>
</form>
</body> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询