Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<label> around an input field eats following elements

See original GitHub issue

I’m not sure what the problem is, but if I have an input field inside a label as recommended by mdn:

  <label> <input type="checkbox" checked> text </label>

// ->
  <label> <input type="text" type="type" checkbox"="checkbox&quot;" />

… The following elements somehow teleport inside the label.

[Edited: Added checked to the input tag, which is required to reproduce the bug.]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

yoshuawuytscommented, Jun 26, 2016
shamacommented, Jun 28, 2016

I’ll look into this again soon. That and <br/> doesn’t work but <br /> does!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Label element - HTML: HyperText Markup Language | MDN
To explicitly associate a <label> element with an <input> element, you first need to add the id attribute to the <input> element.
Read more >
Labeling Controls | Web Accessibility Initiative (WAI) - W3C
Provide labels to identify all form controls, including text fields, checkboxes, radio buttons, and drop-down menus. In most cases, this is done by...
Read more >
HTML label tag - W3Schools
The <label> tag defines a label for several elements: ... clicks the text within the <label> element, it toggles the input (this increases...
Read more >
Can a label only refer to input elements? - Stack Overflow
The <label> tag defines a label for an input element. [Emphasis mine]. Does this mean that the following HTML isn't valid? <!doctype ...
Read more >
HTML <label> Tag - W3docs
The <label> tag defines a text label for the <input> tag. The label is a normal text, by clicking which, the user can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found