This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26339 - Imperatively change (set/add/remove) a form control's labels
Summary: Imperatively change (set/add/remove) a form control's labels
Status: RESOLVED NEEDSINFO
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-15 18:29 UTC by contributor
Modified: 2014-09-18 21:20 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2014-07-15 18:29:47 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html
Multipage: http://www.whatwg.org/C#the-label-element
Complete: http://www.whatwg.org/c#the-label-element
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
It bothers me that `htmlFor` is essentially the only way for us to
imperatively change a control's associated labels. The reasons why are
obvious, it depends on either name or id to be present, and name/id have
undesirable side-effects. It would be super useful if we had a better way to
do this. The use-case is basically to provide a way to associate a label with
a control without putting any nodes in the global object, and without adding
any properties to an HTMLFormElement, but still providing the UI benefits of
associating the label with the control.

Posted from: 99.237.75.191
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2014-09-03 23:14:37 UTC
Can't you just be the control inside the <label>?