How can I make a button that adds characters to a n input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make a button that adds characters to a n input?

like a "number padlock" with buttons 0-9 and when buttons are pressed, they are displayed on an input field? something with a template of this: https://code.sololearn.com/WS19Rax15O7o/?ref=app

15th Jul 2018, 8:48 PM
Joshua Morgan
Joshua Morgan - avatar
4 Answers
+ 2
You can (and you have to) do it with a bit of Javascript. For example, you could create a function called everytime a button is pressed. This function will write the pressed number in the field.
15th Jul 2018, 10:18 PM
Nobody
+ 2
I was trying really hard to figure it out myself but I would never have guessed that. thanks so much!
16th Jul 2018, 12:21 AM
Joshua Morgan
Joshua Morgan - avatar
+ 1
can you show example? I get error messages like "cannot set property "onClick" of null
15th Jul 2018, 11:29 PM
Joshua Morgan
Joshua Morgan - avatar
0
「HAPPY TO HELP」 Because you are always so awesome maybe you can take a look?
15th Jul 2018, 11:36 PM
Joshua Morgan
Joshua Morgan - avatar