我自己写的,点击提交按钮,没能触发这个错误提示呢?为啥?
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<script type="text/javascript" src="http://www.imooc.com/data/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://www.imooc.com/data/jquery.validate.js"></script>
<script type="text/javascript" src="http://www.imooc.com/data/jquery.validate.messages_cn.js"></script>
<style type="text/css">
#title{background-color:blue; width:200px;height:40px;text-align:center;line-height:40px;font-weight:bold;color:#fff;}
</style>
</head>
<body>
<form id="myform" method="get" action="#">
<div id="title">
<span>表单验证插件</span>
<span><input type="button" type="submit" value="提交"/></span>
</div><br>
<div id="content">
<span>邮箱:</span>
<input type="text" id="email" name="email"/><br />
<span></span>
</div>
</form>
<script type="text/javascript">
$(function(){
$("#myform").validate({
rules:{
email:{
required:true,
email:true
}
},
errorPlacement:function(error,element){
error.appendTo(".tishi");
},
}
);
});
</script>
</body>
</html>