Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support proper <label> attributes #74

Open
NHQ opened this issue Sep 23, 2017 · 2 comments
Open

support proper <label> attributes #74

NHQ opened this issue Sep 23, 2017 · 2 comments

Comments

@NHQ
Copy link

NHQ commented Sep 23, 2017

the label element has an attribute "for", which points to an input element label.for == ID

hyperscript scrubs the for attribute out of labels

h('label', {for: "someID"}, text)
@gandhiShepard
Copy link

gandhiShepard commented Apr 19, 2018

The correct JS attribute to use is htmlFor. To correct the snippet above, write this:

h('label', {htmlFor: "someID"}, text)

Read more: https://stackoverflow.com/questions/15750290/setting-the-html-label-for-attribute-in-javascript?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

@kolbasik
Copy link

Or you can specify the attrs property to tell hyperscript sets the following as attributes:

h('label', { attrs: { for: "someID" } }, text)

But I would go with the suggestion above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants