+ 1

Input button number values in a Textbox

Guys, How do i get 5 buttons with number values to show in a textbox when clicked? Like a keypad...I need to use one keypad to input number values into two different textboxes. thus, Username and Password

16th Feb 2018, 7:03 AM
Nana Boafo Yeboah
Nana Boafo Yeboah - avatar
2 Answers
+ 13
When you press the button, you can type the code that links it to the text field, such as the button number 1 or a letter, then press the button to move to the code page, and we write textbox1.text += "1";
16th Feb 2018, 2:11 PM
Bushra Totanji
Bushra Totanji - avatar
+ 4
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <p id="output"></p> <button onclick='write_f("1")'>1</button> <button onclick='write_f("2")'>2</button> <button onclick='write_f("3")'>3</button> <button onclick='write_f("4")'>4</button> <button onclick='write_f("5")'>5</button> </body> <script> var text = ""; var shift = 0; function write_f (symbol) { text += symbol; document.getElementById("output").innerHTML = text; } </script> </html> here it is
16th Feb 2018, 7:23 AM
Sudarshan Rai
Sudarshan Rai - avatar