Skip to content

support proper <label> attributes #74

Open

Description

@NHQ

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)

Activity

  1. gandhiShepard commented on Apr 19, 2018

    @gandhiShepard

    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

  2. kolbasik commented on Apr 26, 2019

    @kolbasik

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions