When i click on button why it not print the value on input box ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When i click on button why it not print the value on input box ??

<input type="text" name="answer"> <input type="button" value="1" onclick="forms.answer.value += '1' ">

13th Jan 2019, 9:57 AM
Raj Kesharwani
Raj Kesharwani - avatar
6 Answers
+ 2
try replacing the onclick value with this. document.querySelector("input[type='text']").value += "1"
13th Jan 2019, 10:09 AM
Seniru
Seniru - avatar
+ 2
i post the photo u can see at my profile
13th Jan 2019, 3:06 PM
Raj Kesharwani
Raj Kesharwani - avatar
+ 1
seniru and Emma sorry it's not working
13th Jan 2019, 11:56 AM
Raj Kesharwani
Raj Kesharwani - avatar
+ 1
yes its working here thnx but when i do same thing on my lappy in notepad it's not working if u have any idea plz tell me
13th Jan 2019, 12:16 PM
Raj Kesharwani
Raj Kesharwani - avatar
+ 1
in result it give two box as for a input and not showing button like function
13th Jan 2019, 1:06 PM
Raj Kesharwani
Raj Kesharwani - avatar
+ 1
Hejab
16th Jan 2019, 10:55 AM
حجاب بعد قليل الشالتالحازمي