S. Miller S. Miller - 2 months ago 5
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.

HTML:

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


JS:

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

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

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