We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is the resolution of problem
$(this).keypress(function (e) { var k = e.charCode || e.keyCode || e.which; var pos = $(this).caret(); if (!k){ return true; } var part1 = this.value.substring(0, pos.begin); var part2 = this.value.substring(pos.end, this.value.length); if (!mask.test(part1 + String.fromCharCode(k) + part2)){ return false; }else{ return true; } });
The text was updated successfully, but these errors were encountered:
function checkKey(e){ var k = e.charCode || e.keyCode || e.which; if (!(e.ctrlKey || e.altKey || e.metaKey) && ((k >= 32 && k <= 125) || k > 186)){ return k; } return null; }
$(this).keypress(function (e) { var k = checkKey(e); if (!k) { return true; } var pos = $(this).caret(); var part1 = this.value.substring(0, pos.begin); var part2 = this.value.substring(pos.end, this.value.length); if (!mask.test(part1 + String.fromCharCode(k) + part2)){ return false; }else{ return true; } });
Sorry, something went wrong.
I'm also see problems in IE... Solve it by that way:
if (!event.which) return true; var begin, end; if (this.setSelectionRange) { begin = this.selectionStart; end = this.selectionEnd; } else if (document.selection && document.selection.createRange) { var range = document.selection.createRange(); begin = 0 - range.duplicate().moveStart('character', -100000); end = begin + range.text.length; } var part1 = this.value.substring(0,begin); var part2 = this.value.substring(end,this.value.length); if (!mask.test(part1 + String.fromCharCode(event.which) + part2)){ return false; }
No branches or pull requests
It is the resolution of problem
$(this).keypress(function (e) {
var k = e.charCode || e.keyCode || e.which;
var pos = $(this).caret();
if (!k){
return true;
}
var part1 = this.value.substring(0, pos.begin);
var part2 = this.value.substring(pos.end, this.value.length);
if (!mask.test(part1 + String.fromCharCode(k) + part2)){
return false;
}else{
return true;
}
});
The text was updated successfully, but these errors were encountered: