is it valid html under html5 definitions to use a label’s “for” value as an id of a normal div element (for example I have made a custom dropdown list implementation which is encased inside a div)
Please let me know if possible,
Thomas
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not according to the spec:
http://www.w3.org/TR/html5/forms.html#category-label
See also:
http://www.w3.org/TR/html5/the-label-element.html#attr-label-for
I do think the question presents a valid use case. I’m not sure what the recommended pattern is for such a scenario, though ARIA attributes might help to make the markup more accessible:
https://developer.mozilla.org/en/Accessibility/ARIA/forms/Basic_form_hints
https://developer.mozilla.org/Special:Tags?tag=ARIA