1

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 advance

Appericiate for Replys... Please Check @

http://jsfiddle.net/JxfcH/#

Not Worked..

1
  • Please see my edit to learn how to format your code properly for the next time - regarding your question, you were using innerHTML instead of value. Commented May 15, 2011 at 12:19

2 Answers 2

2

you must assign value to the "value" attribute of the input box.

document.getElementById("musicstock1").value = "5";
Sign up to request clarification or add additional context in comments.

1 Comment

Not Working .. Please Check This link..I have tested but no result.
0

You want:

function insert () {
    document.getElementById('musicstock1').value = "5";
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.