我正在尝试使用此处http://validator.codeplex.com中的脚本验证表单。
这是我的 HTML 表单:
<form action="#" method="POST" id="input" autocomplete="on">
<fieldset>
<input type="text" name="name" id="name" value="" maxlength="60" validate="form" require="Please enter your name." />
<input type="email" name="email" id="email" value="" maxlength="80" validate="form" require="Please enter your email address." email="Please enter a valid email address." />
<input type="url" name="url" id="url" value="" maxlength="400" validate="form" require="Please enter your website." />
<input type="checkbox" id="updates" name="updates" />
<input type="checkbox" id="agree" name="agree" validate="form" require="Please agree to the terms."/>
<input type='submit' value="" id="submit" onclick="return validate('form');" />
</fieldset>
</form>
除复选框外,所有字段均已正确验证。我不确定如何使用脚本正确验证复选框部分。有什么想法吗?
另外-这里是javascript部分:http: //jsfiddle.net/baumdexterous/TBtSD/
谢谢!!