0

I have a below code

 <input type="text" oninput="OnInput (event)" onpropertychange="OnPropChanged (event)" value="Text field" />

   function OnInput (event) {
            alert ("The new content: " + event.target.value);
        }
            // Internet Explorer
        function OnPropChanged (event) {
            if (event.propertyName.toLowerCase () == "value") {
                alert ("The new content: " + event.srcElement.value);
            }
        }

In the oninput() and onropertychange events ,not able to get the keycode.

I need to find the ASCII value for the number typed in textbox. For Example ,How to find the keycode value for number 5. Is any inbuild javascript methods to find this? or any other solutions

Roy thomas
  • 115
  • 1
  • 8

1 Answers1

1

try this (either which or keyCode should work, depend on which browser you are)

var kc = event.which || event.keyCode;
LorDex
  • 2,591
  • 1
  • 20
  • 32