jquery验证没实现 求找问题所在。。
在head里写了jquery<scripttype="text/javascript"src="js/jquery-1.8.3.min.js"></script><scr...
在head里写了jquery
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#login").validate({
rules:{
username:{
required:true,
minlength:2,
},
password:{
required:true,
rangelength: [6,16],
}
},
messages:{
username: {
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters",
},
password: {
required: "Please provide a password",
rangelength: "Your password must be at least 6 characters long"
},
},
});
});
</script>
表单如下
<section class="main">
<form class="form-1" id="login" action="Login" method="post" theme="simple">
<p class="field"><label for="username"></label>
<input type="text" name="login_name" id="username" placeholder="Username">
<i class="icon-user icon-large"></i>
</p>
<p class="field"><label for="password"></label>
<input type="password" name="login_pass" id="password" placeholder="Password">
<i class="icon-lock icon-large"></i>
</p>
<p class="submit">
<button type="submit" name="submit"><i class="icon-arrow-right icon-large"></i></button>
</p>
</form>
</section> 展开
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#login").validate({
rules:{
username:{
required:true,
minlength:2,
},
password:{
required:true,
rangelength: [6,16],
}
},
messages:{
username: {
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters",
},
password: {
required: "Please provide a password",
rangelength: "Your password must be at least 6 characters long"
},
},
});
});
</script>
表单如下
<section class="main">
<form class="form-1" id="login" action="Login" method="post" theme="simple">
<p class="field"><label for="username"></label>
<input type="text" name="login_name" id="username" placeholder="Username">
<i class="icon-user icon-large"></i>
</p>
<p class="field"><label for="password"></label>
<input type="password" name="login_pass" id="password" placeholder="Password">
<i class="icon-lock icon-large"></i>
</p>
<p class="submit">
<button type="submit" name="submit"><i class="icon-arrow-right icon-large"></i></button>
</p>
</form>
</section> 展开
1个回答
网易云信
2023-12-06 广告
2023-12-06 广告
很高兴能回答您的问题。以下是一段针对“一对一消息组件”的描述,字数在200字左右:该组件支持用户之间的私密交流,让沟通更加直接和高效。通过它,您可以向特定对象发送消息,并实时查看消息状态,包括对方是否已读或未读。同时,该组件还支持富文本消息...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询