开发者

HTML5 - Validation messages

开发者 https://www.devze.com 2023-01-18 21:16 出处:网络
What element should I use to show validation开发者_StackOverflow中文版 messages (errors) to the user? Which one is more semantic in HTML5?You could consider adding an ARIA role of \'alert\' or \'statu

What element should I use to show validation开发者_StackOverflow中文版 messages (errors) to the user? Which one is more semantic in HTML5?


You could consider adding an ARIA role of 'alert' or 'status'. I don't think that semantically any of the HTML elements is any better than <div class="error">


I typically would use a div with an error or notice class to show errors.


I would use javascript to show a javascript error box containing the erro(s).

EDIT: For server side validation we use a <div> that gets filled after an ajax call.

0

精彩评论

暂无评论...
验证码 换一张
取 消