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
  • 197,815
  • 30
  • 248
  • 265
JSON_Derulo
  • 715
  • 11
  • 31

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,728
  • 3
  • 17
  • 32
0

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

debute
  • 2,638
  • 6
  • 30
  • 55
0

<input> elements have values, not inner HTML:

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