How can I enter only numbers in TextBox using JavaScript without disable right click ?

Posted by Space Cracker on Stack Overflow See other posts from Stack Overflow or by Space Cracker
Published on 2010-05-31T07:59:03Z Indexed on 2010/05/31 8:03 UTC
Read the original article Hit count: 162

I want to allow numbers only to be allowed for a textbox and I already do it onkeydown event by allow only numbers and prevent ctrl+V but I have two problems :

  1. if I make right click then paste so any char can be entered and I want a solution without disable right click by oncontextmenu="return false;"

  2. if I drag and drop any text it will be entered

Is there any solution that can work in all browsers without problem ?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about javascript-events