本文共 418 字,大约阅读时间需要 1 分钟。
required属性可以规定表单元素为必须。
代码实例如下:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 | <!doctype html> < html > < head > < meta charset = "utf-8" > < meta name = "author" content = "" /> < title >蚂蚁部落</ title > </ head > < body > < form > < input id = "text" required /> < input id = "button" type = "submit" /> </ form > </ body > </ html > |
如果文本框为空,那么提交表单的时候就会报错。
原文发布时间为:2017-3-9
本文作者:admin
本文来自云栖社区合作伙伴“蚂蚁部落”,了解相关信息可以关注蚂蚁部落
原文链接:
转载地址:http://impxl.baihongyu.com/