Unable to fire onKeyUp And onKeyDown message

Posted by Sahoo under JavaScript on 10/25/2012 | Points: 10 | Views : 1617 | Status : [Member] | Replies : 2
Hi ,

I had code like
<asp:TextBox ID="txtAddress1" runat="server" onKeyDown="limitText();" onKeyUp="limitText();"></asp:TextBox>.This is working fine if I am typing text in the text box.But If I am copying text and pesting it with mouse (NOT WITH CRTL+ V) , THEN IT IS NOT FIRING the event.How to fix it.

Thanks In advance




Responses

Posted by: Pooraniidhayabalama on: 10/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

The "keyup" and "keydown" events doesn't get fired when you paste the text in the text box using mouse. You can use "onpaste" event to achieve your requirement.

Code:

<asp:TextBox ID="txtAddress1" runat="server" onKeyDown="limitText();" onKeyUp="limitText();" onpaste ="limitText();"></asp:TextBox>


Regards,
Poorani


Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 10/26/2012 [Member] Starter | Points: 25

Up
0
Down
onkeyup=" return limitText();"

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response