function keyPressFunctionForValidations(e) { debugger; var charCode = (e.which) ? e.which : e.keyCode switch (e.type) { case 'keydown': if (e.ctrlKey == true && (charCode == 118 || charCode == 86)) { e.preventDefault(); return; } var isValid = (charCode >= 37 && charCode <= 40) || (charCode >= 65 && charCode <= 90) || charCode == 32 || charCode == 46 || charCode == 8 || charCode == 9 || charCode == 67 || charCode == 86 || charCode == 17; if (isValid == false) { e.preventDefault(); return; } break; case 'paste': e.preventDefault(); return; break; } }
i have the paste function as follow function validateOnPaste(e) { debugger; var theEvent = e || window.event; var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode(key); var regex = /[a-zA-z]|\s/; if (!regex.test(key)) { e.preventDefault(); return; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)