Click here to Skip to main content
15,891,721 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Iam writing a function on onkeydown and onpress event
like below
C#
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57&& charCode != 190 && charCode != 110 && (charCode > 105 || charCode < 96||))
            return false;

         return true;
      }


It is accessing + and - of the number pad but when am trying to enter + and - from keybord padds
i.e by using shift + = for plus and shift +- for minus
it is not allowing to enter + and - because the event is firing on pressing of shift only how to make text box to allow numbers qith plus and minus symbol using key board
Posted
Updated 24-Mar-14 8:33am
v3

In the allowed characters, you will have to allow the code 15 as well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900