我只是想检查来自 field 和 field1 的输入是否相同。但我不确定我的错误在哪里。
jQuery代码:
$(document).ready(function () {
$('#f').validate({
rules: {
field: {
nowhitespace: true,
minlength: 6,
required: true
},
field11: {
equalTo: "#field1",
required: true
}
},
messages: {
field: {
required: "required",
minlength: "min 6."
},
field11: {
required: "required",
equalTo: "same as field."
}
},
submitHandler: function (form) {
javascript:document.f.submit();
}
});
});
HTML:
<form name="f" action="/path/to/service" method="POST">
<table>
<tr>
<td><label for="field">Field</label>: </td>
<td>
<input class="field" class="pw" type='field' id="field" name='field' size="20" />
</td>
</tr>
<tr>
<td><label for="field1">field 1</label>: </td>
<td>
<input class="field" class="pw" type='field1' id="field1" name='field1' size="20" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan='2' align="center">
<input name="submit" type="submit" value="Submit" />
</td>
</tr>
</table>
</form>
谁能看到我的错误?谢谢任何帮助