为什么没有效果呀,有没有大神有现在可以引用插件链接
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
fieldset{
width: 400px;
border:1px solid pink;
}
</style>
</head>
<body>
<script src="jq-cj/dist/jquery.validate.js"></script>
<script src="https://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<button id="yjh">点这</button>
<script>
$('#yjh').click(function(){
alert("这个有用");
})
</script>
<script>
$(document).ready(function(){//当页面载入后
$('#demoForm').validate({//以下约定的是name值
rules:{
username:{
required:true,
minlength:2,
maxlength:10
},
password:{
required:true,
minlength:2,
maxlength:16
}
},
messages:{//提示信息
username:{
required:"必须填写用户名",
minlength:"用户名最小为2位",
maxlength:"最大为40位"
},
password:{
required:"必须填写密码",
minlength:"最小为2位",
maxlength:"最大为16位"
}
}
});
});
</script>
<div>
<form id="demoForm">
<fieldset>
<legend>用户登录</legend>
<label for="username">用户名:</label><!-- for的作用:当点击用户名时使鼠标聚焦在输入框 -->
<input type="text" id="username" name="username"><br>
<label for="password">密 码:</label>
<input type="password" id="password" name="password"><br>
<input type="submit" name="" value="登录">
<input type="reset" name="" value="重置">
</fieldset>
</form>
</div>
</body>
</html>