I want to disable the keyboard for an HTML SELECT tag so the user can only use a mouse to select the options.
I've tried event.cancelBubble=true
on the onkeydown
, onkeyup
and onkeypress
events with no luck.
Any ideas?
In a cross-browser way assuming that the event object has been properly initialized:
function disableKey(e)
{
var ev = e ? e : window.event;
if(ev)
{
if(ev.preventDefault)
ev.preventDefault();
else
ev.returnValue = false;
}
}
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