如何在不使用所必需的属性的情况下验证 HTML5 输入
要避免验证,在 HTML5 中使用 formnovalidate 属性。在示例中,禁用了第 2 个按钮的验证 −
示例
<!DOCTYPE html> <html> <head> <title>HTML formnovalidate attribute</title> </head> <body> <form action = "new.php" method = "get"> Rank <input type = "number" name = "rank" required><br> <input type = "submit" value = "Submit"><br> <input type = "submit" formnovalidate = "formnovalidate" value = "Submit with no validation"> </form> </body> </html>
广告