4

Possible Duplicate:
Should I put input tag inside label tag?

Is it valid to have an input element within a label element to associate the input with the label? Example:

<label>Email Address: <input name="email" type="text" /></label>

Will major browsers associate the label and input control, without the label's for attribute specified?

I've seen it done this way several times, but was wondering if this is kosher HTML.

Community
  • 1
  • 1
Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346

2 Answers2

4

Should I put input tags inside a label tag?

Community
  • 1
  • 1
Moin Zaman
  • 25,281
  • 6
  • 70
  • 74
1

According to this, it looks like it's okay. Will test in major browsers...

Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346