Search code examples
javascripthtmlinputinnerhtml

document.getElementById("attribute_orderfield1_value").innerHTML fails writing into input field


I have a little problem by writing some text into this input-field.

<input type="text" data-pseudo-text="true" data-selector=".attribute-orderfield1--hidden" placeholder="some text" name="attribute_orderfield1_value" id="attribute_orderfield1_value" class="input--attribute-orderfield1" data-type-aof="input">

I tried it before in a test without the attribute data-type-aof and it worked.

document.getElementById("attribute_orderfield1_value").innerHTML = "some text";

Is this attribute preventing writing into the field via JS?


Solution

  • If I understand you correctly, you are just trying to set the value, just use:

    document.getElementById("attribute_orderfield1_value").value = "some text";