S. Miller S. Miller - 1 year ago 52
HTML Question

Why can't I display a variable in a text field?

I have a function that creates a string and I would like for it to be displayed in a textbox on the page. I cannot understand why this does not work.


<input id="poNum" type="text" name="PO" id="PO" style="width: 310px;" readonly />


document.getElementById("poNum").innerHTML = number;

Answer Source
 document.getElementById("poNum").value = number;

InnerHTML is accessing... well, the actual inner html. Where as value is a attribute for inputs (selects, buttons, etc).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download