wrapping input elements inside labels to prevent duplicate id-attributes

wrapping input elements inside labels to prevent duplicate id-attributes

quick share:

If you wonder how to prevent duplicate id-attributes on repeating elements (like popups with login-form, forms in toolbars, which can all end up being in the DOM multiple times):

You can also wrap the input in the label like so: 
  1. <label>some text 
    <input type="text" name="form_id" value="write something" />
    </label>

which will produce pretty much the same as the doc's
  1. <label for="form_id">some text</label> 
    <input type="text" id="form_id" name="form_id" value="write something" />
only... without id-attribute.

This way scripts don't get confused with duplicate ids and validation will not complain for using <label for="missing_id">...</label>