我有一个页面,包含以下内容:如何在单个页面上检查多个表单上的必填字段?
<!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
为什么你特别需要在这里有两种形式?如果你只是有一张地图,它可以驻留在表单标签内。 –