In devtools, run the following two lines:
1.
window.x = document.createElement("input"); x.type="text"; x.name="nm"; x.value="val"; x // <input type="text" name="nm">
2.
window.x = document.createElement("input"); x.type="text"; x.name="nm"; x.setAttribute("value", "val"); x // <input type="text" name="nm" value="val">
Why will it print differently? The value appears to be correctly set in both cases. There seems to be a gap between the property and the DOM attribute.
Also, the getter property for the .value property becomes different than the result of .getAttribute('value') . I can setAttribute() all day, but .value returns the old value.
source share