I'm reworking a site which uses inputs like this multiple times throughout a page:
<input type="text" name="delDate" value="06.03.2012" />
There's always an adjacent hidden input, which gives the date enterted above a specific id, when the form is submitted, but I'm wondering if doing it like this (and omitting an input#id is a valid way doing things, since the W3C validator does not complain about it.
Thanks for some input!
Yes, that is valid. The id
attribute is not required.
The problem of doing this is not that it is a validity problem but that it creates an accessibility problem (i.e., it may confuse screen readers for disabled users). It is generally considered best to have a label with a "for" attribute that matches the "id" attribute of the associated input element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With