Giving function to enter button which is in keyboard | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Giving function to enter button which is in keyboard

I have a textbox. While I am writing , if I click to enter, It runs a function How can I make that ?

6th Jun 2017, 5:58 PM
Serhat Merak
Serhat Merak - avatar
5 Answers
+ 8
Here's my demo. Check it out please. It supports PC and Mobile, Tablet. [Pure JS] https://code.sololearn.com/W1MIaDzPb75n/?ref=app [JQuery] https://code.sololearn.com/WKjNU0hPKAez/?ref=app
6th Jun 2017, 10:48 PM
๊น€์ •์ œ(Legacy)
๊น€์ •์ œ(Legacy) - avatar
+ 1
document.onkeydown = function(e) { if(e.keyCode == 13){ myFunction(); } }; }
6th Jun 2017, 6:03 PM
StoffelJs
0
I guess it is working on computer but I want to make that on my mobile phone Do you know that's mobile version ? Thank you ๐Ÿ˜Š
6th Jun 2017, 6:16 PM
Serhat Merak
Serhat Merak - avatar
0
I found ๐Ÿ˜‚๐Ÿ˜‚ <input type="search"> and Event is document.getElementsByTagName("input")[0].onsearch=function(){ // }
6th Jun 2017, 6:30 PM
Serhat Merak
Serhat Merak - avatar
0
could you look my new question
9th Jun 2017, 3:12 PM
Serhat Merak
Serhat Merak - avatar