JSFiddle - React, Tailwind, and code Playground
by Chandana Thota
HTML
<!--code to get keyboard ascii codes-->
<input type=text id="tbx" value="arrow keys and Ascii codes">
JavaScript
$('#tbx').keydown(function(pk){
if(pk.keyCode == '37')
{
alert("Pressed left arrow key and ascii code is " + pk.keyCode);
}
if(pk.keyCode == '38')
{
alert("Pressed up arrow key and ascii code is " + pk.keyCode);
}
if(pk.keyCode == '39')
{
alert("Pressed right arrow key and ascii code is " + pk.keyCode);
}
if(pk.keyCode == '40')
{
alert("Pressed down arrow key and ascii code is " + pk.keyCode);
}
});