0

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;
j08691
  • 204,283
  • 31
  • 260
  • 272
JSON_Derulo
  • 892
  • 2
  • 14
  • 39

3 Answers3

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

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

Caspar Wylie
  • 2,818
  • 3
  • 18
  • 32
0

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

Patrik Krehák
  • 2,595
  • 8
  • 32
  • 62
0

<input> elements have values, not inner HTML:

document.getElementById("poNum").value = number;
Zoli Szabó
  • 4,366
  • 1
  • 13
  • 19