即使在表单中,HTML 输入“必需”也不起作用

CodeXtack

我有一个文本框和一个带有 'required' 属性的清单,当我按下一个按钮进入下一页而不填写两个输入时,它们不会验证它们是否已填写。

<form id="form" method="" action="">
   <input type="text" name="dressPrice" id="price" class="control" onkeypress="return numberFilter(event)" dir="rtl" onpaste="return false" required />
   <input type="checkbox" id="cbox1" required /><label class="tac-label"> I accept the <a href="terms-and-conditions.html" class="tac-link">terms and conditions.</a>

   <a href="buy-step-02.html" class="btn is-small" type="submit">Search</a>
</form>

最奇怪的部分是,我有另一个带有表单的 HTML 页面,并且那里输入的“必需”属性工作正常。任何人都知道为什么会发生这种情况?

我不认为这是一个兼容性问题。

克里斯蒂安·崔

使用inputinsted的的a还有一个失踪</label>

<form id="form" method="" action="buy-step-02.html">
   <input type="text" name="dressPrice" id="price" class="control" onkeypress="return numberFilter(event)" dir="rtl" onpaste="return false" required />
   <input type="checkbox" id="cbox1" required /><label class="tac-label"> I accept the <a href="terms-and-conditions.html" class="tac-link">terms and conditions.</a>
</label>
   <input  class="btn is-small" type="submit" value="Submit"/>
</form>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章