Reputation: 7059
alt=""
attribute isn't valid on <input>
tags. Why this choice?
I know that alt
is meant to provide an alternative content if "main" content is not available, and since the input
tag is there to actually input something an alternative text wouldn't be useful, but nowadays alt
attributes are mostly used for accessibility purposes! If no alt
or name
or placeholder
are present the only attribute to decipher the nature of the element would be the type
. But what if multiple inputs with same type are present?
What do you thing?
Upvotes: 0
Views: 266
Reputation: 7067
label
is actually used for this purpose, for example:
<label for="name">Enter your name:</label>
<input id="name" name="name">
This form can give you all the information you need, and even a screen reader can figure it out :)
This is mentioned here in Creating Accessible Forms, as well as many other sources.
Upvotes: 2