I used code in the below method to block my keyboard and it worked for me.
<asp:textbox id="t1" onkeypress="return false;" />
Now I want to add some more for for it and I tired to do the same using extra code as
<script type="text/javascript">
fuction disablekeys()
{
return false;
}
</script>
<asp:textbox id="t1" onkeypress="disablekeys();" />
But this code is not working. Why?
You need to return the value returned by disablekeys
:
<asp:textbox id="t1" onkeypress="return disablekeys();" />
Your new onkeypress
handler currently ignores this value.
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