Setting the HTML <label> 'for' attribute in JavaScript

Use the htmlFor attribute. I assume it has a slightly cryptic name because for is a keyword in JavaScript:

var label = document.createElement('label');
label.htmlFor = 'some-input-id';