+ 1

Fetching the entered key on the keyboard with jquery--Returns a number

I took an interesting Jquery course here on Solo Learn and i came across some snippet of code that should display the value of the keyboard button that was pressed.. Below is the code <!DOCTYPE html> <html> <head> <script src="jqeury-3.4.1.min.js"></script> </head> <body> <input type="search" id="name"> <script> $(document).ready(function(){ $("#name").keydown(function(){ alert(event.which); }); }); </script> </body> </html> Why isn't it returning the actual letter when i press on one, its just returning numbers

15th Aug 2020, 7:13 PM
Timothy Njiru
Timothy Njiru - avatar
4 Answers
+ 1
By default, thats how they are supposed to work... Thanks. Is there a jquery function to return the letter
15th Aug 2020, 7:59 PM
Timothy Njiru
Timothy Njiru - avatar
15th Aug 2020, 7:57 PM
JME
0
Thanks a lot @JME
15th Aug 2020, 8:02 PM
Timothy Njiru
Timothy Njiru - avatar