ReferenceError: event is not defined in my application when i am calling from jquery -


when calling function getting error:

 if (event.keycode == 46 || event.keycode == 8 || event.keycode == 9 || event.keycode == 27 || event.keycode == 13 ||  referenceerror: event not defined  

here code:

 $(".decimalonly").each(function () {                     $(this).keydown(function (e) {                           if (event.keycode == 46 || event.keycode == 8 || event.keycode == 9 || event.keycode == 27 || event.keycode == 13 ||                                      (event.keycode == 65 && event.ctrlkey === true) ||                                     ((event.keycode == 190 || event.keycode == 110) && $(this).val().indexof(".") == -1) ||                                      (event.keycode >= 35 && event.keycode <= 39)) {                              return;                         }                         else {                             keypress                             if (event.shiftkey || (event.keycode < 48 || event.keycode > 57) && (event.keycode < 96 || event.keycode > 105)) {                                 event.preventdefault();                             }                         }                     });                 }); 

you're passing e function in function you're calling event. replace $(this).keydown(function (e) $(this).keydown(function (event) , you're fine.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -