【发布时间】:2009-11-03 14:14:56
【问题描述】:
我想创建一个表单,用户在每个文本框中输入一个数字。当用户单击按钮时,我需要所有这些数字都是正确的——想象一下 iPhone 密码锁定功能。
理想情况下,我希望该按钮仅在所有数字都正确时才可点击(可能使用我定义的变量) - 否则它不会执行操作。
HTML -
<form id="journey">
<input name="code1" type="text" class="code onlyNumeric" maxlength="1" />
<input name="code2" type="text" class="code onlyNumeric" maxlength="1" />
<input name="code3" type="text" class="code onlyNumeric" maxlength="1" />
<input name="code4" type="text" class="code onlyNumeric" maxlength="1" />
<input name="code5" type="text" class="code onlyNumeric" maxlength="1" />
<input type="button" class="button" value="Next location" />
</form>
目前我正在查看是否可以将它与 jQuery/Javascript 一起使用,但不确定如何去做。
非常感谢您对此提供的帮助。谢谢。
【问题讨论】:
标签: jquery validation forms variables textbox