-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
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
IE not work #3
Comments
function checkKey(e){
|
I'm also see problems in IE... 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;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: