我正在尝试使用这个 jQuery 插件http://bassistance.de/jquery-plugins/jquery-plugin-validation所以我可以验证我正在制作的表格。但它似乎没有验证电话字段。谁能帮我理解我做错了什么?
到目前为止,这是我的代码
<script type="text/javascript">
var validator
jQuery(document).ready(function() {
validator = jQuery("#participateform").validate();
});
function sendRequest(){
var validform=validator.form();
if(validform)
{
alert("Form is valid");
}
}
</script>
<form id="participateform" >
<div class="table">
<div class="tr">
<div class="td">fullname</div>
<div class="td">
<input type="text" value="" id="fullname" name="fullname" class="required" />
</div>
</div>
<div class="tr">
<div class="td">your e-mail </div>
<div class="td">
<input type="text" value="" id="e-mail" name="e-mail" class="required email" />
</div>
</div>
<div class="tr">
<div class="td">area</div>
<div class="td">
<select id="area" name="area"></select>
</div>
</div>
<div class="tr">
<div class="td">Phone 1</div>
<div class="td">
<input type="text" value="" id="phone" name="phone" class="required phone"/>
</div>
</div>
<div class="tr">
<div class="td">Phone 1</div>
<div class="td">
<input type="text" value="" id="phone2" name="phone2" />
</div>
</div>
</div>
<input type="button" id="btnsubmit" value="submit" onclick="sendRequest()">
</form>