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;
     }

Était-ce utile?

La 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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top