required 属性可以在 input、select 和 textarea 元素上使用。
您可以尝试运行以下代码来实现只读 属性 -
<!DOCTYPE html> <html> <head> <title>HTML placeholder attribute</title> </head> <body> <h2>Register</h2> <form action = "/new.php"> <input type = "text" placeholder = "Student UserName" name = "name" required/><br> <input type = "submit" value = "Submit"> </form> </body> </html>
以上就是如何在HTML中指定在提交表单之前必须填写元素?的详细内容,更多请关注php中文网其它相关文章!
已抢187052个
抢已抢67493个
抢已抢353723个
抢已抢668366个
抢已抢123781个
抢已抢25926个
抢