Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:49:17+00:00 2026-06-08T15:49:17+00:00

is it valid html under html5 definitions to use a label’s for value as

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:49:19+00:00Added an answer on June 8, 2026 at 3:49 pm

    Not according to the spec:

    Some elements, not all of them form-associated, are categorized as
    labelable elements. These are elements that can be associated with a
    label element.

    “button” “input” (if the type attribute is not in the hidden state) “keygen”
    “meter” “output” “progress” “select” “textarea”

    http://www.w3.org/TR/html5/forms.html#category-label

    See also:

    The for attribute may be specified to indicate a form control with
    which the caption is to be associated. If the attribute is specified,
    the attribute’s value must be the ID of a labelable element in the
    same Document as the label element. If the attribute is specified and
    there is an element in the Document whose ID is equal to the value of
    the for attribute, and the first such element is a labelable element,
    then that element is the label element’s labeled control.

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Are self-closing tags valid in HTML5? For example: <div id=myDiv /> Something
I would like to convert some value from a XML attribute into valid HTML
I have a string, that may or may not be valid HTML , but
Is it valid HTML to have the following: <form action="a"> <input.../> <form action="b"> <input.../>
if I have a valid html fragment in a variable like so; var responseText
How can I check that content generated by JavaScript is valid HTML? For example,
as per the title; is it possible to have nested comments in valid HTML?
Is there a way to check if a tag is valid html tag and
i.e. - <form action=http://192.168.1.20/form_action.asp method=get> vs. ( without a specific handler, still valid html?
Possible Duplicate: What are valid values for the id attribute in HTML? Underscores seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.