Question

This is the code i have been confusing about the function although it makes my work function but how can i know what does this few code handle event or process?? And what is evt.which stand for??

<script type="text/javascript">

     function isNumberKey(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57)) {
             alert("Please Enter Only Number Value!!!");
             return false;
         }

         return true;
     }

Was it helpful?

Solution

e.which is not an event, which is a property of the event object, which most people label as e in their event handlers. It contains the key code of the key which was pressed to trigger the event (eg: keydown, keyup).

http://api.jquery.com/event.which/

You should read this documentation. You will find your answer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top