繁体   English   中英

如何在单个页面上检查多个表单上的必填字段?

[英]How do I check required fields on multiple forms on a single page?

我的页面包含以下内容:

<!DOCTYPE html>
    <html>
        <body>

        <form action="demo_form.asp">
          Username: <input type="text" name="usrname" required>
        </form>

        <div class="map"></div>
        <div><p>Some content to explain some things</p></div

        <form action="demo_form.asp">
          Username: <input type="text" name="lastusrname" required>
          <input type="submit">
        </form>

        <p><strong>Note:</strong> The required attribute of the input tag is not supported in Internet Explorer 9 and earlier versions, or in Safari.</p>

    </body>
</html>

当您单击“提交”时,它仅检查包含输入提交的第二个表单。 我假设我将需要编写一些JQuery或Javascript函数来检查是否填写了所有必填字段?

两种形式的原因是在两种形式之间我还有其他html

两种形式的原因是在两种形式之间我还有其他html

可以在表单中嵌入其他HTML-试试吧。 两个FORM元素的存在正在破坏您的表单提交。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM