我有一個頁面,包含以下內容:如何在單個頁面上檢查多個表單上的必填字段?
<!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
爲什麼你特別需要在這裏有兩種形式?如果你只是有一張地圖,它可以駐留在表單標籤內。 –