How to set the "value" and "for" attribute using Object.assign

Solution 1:

Since for is a reserved keyword in JavaScript, you need to use htmlFor property on label element, like this:

Object.assign(labelElName, {htmlFor: "iname"});

or

labelElName.htmlFor = "iname";