jquery validate用法
首先在头文件中引入所需要的js文件,对需要验证的<input></input>标签中加入minlength="4",即可限定最少输入个字符。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<script type="text/javascript" src="../js/jquery-latest.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#commentForm").validate();
});
</script>
</head>
<body>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<div>
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>Please Login </legend>
<table>
<tr>
<td><label for="cname">nick</label></td>
<td><em>*</em><input id="nick" name="nick" size="25" minlength="5" maxlength="10"/></td>
</tr>
</table>
<input class="submit" type="submit" value="Submit"/>
</fieldset>
</form>
</div>
</body>
</html>