How to code a key as a button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to code a key as a button

How do u make the enter key on a computer be a button

22nd Jan 2020, 4:12 PM
ANONYMOUS
ANONYMOUS - avatar
5 Answers
+ 3
Hi! Can you explain what you want to do exactly ?
22nd Jan 2020, 4:14 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
You mean a GUI program ? An application where you can have buttons and other ?
22nd Jan 2020, 4:16 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
https://code.sololearn.com/Wg8En00z15Os/?ref=app so i want the enter button be the grade button on the screen
22nd Jan 2020, 4:18 PM
ANONYMOUS
ANONYMOUS - avatar
+ 1
yes so let say some one wants to make the enter button on a computer act like the button you click on the screen
22nd Jan 2020, 4:15 PM
ANONYMOUS
ANONYMOUS - avatar
+ 1
Use key event listeners, in javascript. Just as you use button on click , you can use on key down , on key press, on key up , the same way. The assigned function will be called whenever the listener receives the key presses the passed event, event.keycode can be used to get key code pressed, to detect whenever someone presses return key
22nd Jan 2020, 5:04 PM
Sandeep Chatterjee