如何在不使用所必需的屬性的情況下驗證 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>
廣告