我正在使用 jQuery 表单验证插件,当用户在表单为空时单击提交按钮时,我需要显示错误。但是,我的点击事件没有响应。
<!DOCTYPE HTML>
<html>
<head>
<link type = "text/css" rel="stylesheet" href="css/bootstrap.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://jzaefferer.github.com/jquery- validation/jquery.validate.js"></script>
<script src="js/bootstrap.js"> </script>
<script>
$('#submit').click(function(){
$('form').validate()
});
</script>
</head>
<body>
<form class = "well span6">
<label> Username </label>
<input type="text" id = "myName" class ="span3" placeholder ="Type your username here..." class = "required"/>
<label> Password</label>
<input type="text" id "myPassword" class ="span3" placeholder ="Type your password here..." class = "required"/> <br/>
<button id = "submit" class ="btn btn-primary">Submit </button>
<button class = "" > Clear <br/></button><br/>
</form>
</body>
</html>
任何帮助都将受到赞赏和奖励。