how to trigger keyboard specif key.Code
event with jQuery?
I woul like to trigger specifically backspace keyboard event
var e = jQuery.Event("keydown");
e.which = 8; // some value (backspace = 8)
$("input").trigger(e);
<body onkeydown="return inspectKeyCode(event);">
function inspectKeyCode(event)
{
if(event.keyCode == 8){
//Do whatever
//For disabling return false;
}
}
By this you can cancel the backspace button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With