Please clarify the use of the W3C tag label

The W3C specification for tag labels http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1 says:

The LABEL element can be used to attach information to controls.

Does "information" include error messages?

+4
source share
1 answer

You can use it, since you can attach more tags to one input.

It also has accessibility considerations. This article recommends the following (consider the role attribute):

 <label for="userEmail" role="alert">That email address is invalid.</label> 
+5
source

Source: https://habr.com/ru/post/1345561/


All Articles