JSFiddle - React, Tailwind, and code Playground
HTML
<label>Click and press any key : </label><input id="textbox" type="text" size="30" />
<div>
<label>Detected keycode : </label><span id="keydownCode">0</span>.
</div>
<div>
<label>Type of Transaction : </label><span id="Typoef">0</span>.
</div>
CSS
body {
background:#abcdef;
}
label {
margin:10px;
font-size:20px;
}
input {
height:20px;
}
div {
margin-top:15px;
}
JavaScript
$('#textbox').keydown(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
$('#keydownCode').html(keycode);
if(keycode == 144){
$('#Typoef').html('It is a Sell');
//perform Sell operation here
}
else if(keycode == 109){
$('#Typoef').html('It is a Purchase');
//perform Purchase operation here
}
else{
$('#Typoef').html('');
}
});