JavaScript - How to Insert Number to InputBox by using Button
Please help, How to insert number into inputbox by Id.
<input name="table1" type="text" size="1" id="musicstock1"/>
Would like to insert for example number (5) into this particular input box when button clicked.
So push the "Insert" button number 5 show on inputbox
is this correct?
function insert () {
document.getElementById('musicstock1').innerHTML = "5";
}
Thank you in adva开发者_如何学JAVAnce
Appericiate for Replys... Please Check @
http://jsfiddle.net/JxfcH/#
Not Worked..
you must assign value to the "value" attribute of the input box.
document.getElementById("musicstock1").value = "5";
You want:
function insert () {
document.getElementById('musicstock1').value = "5";
}
精彩评论