문제

I am using the jQuery inputmask from https://github.com/RobinHerbots/jquery.inputmask and have no problem in Firefox, Chrome or IE 8+.

However, when I use the below regex input masks, IE 7 only displays the first character from the data source. I know the data is present because if I switch document modes from IE 7 standards to IE 8 standards or higher, the data is immediately visible.

Is there any way to get the regex input mask to show all the data in IE 7?

$(".alpha").inputmask('Regex', { regex: "[a-zA-Z ]+" }); // Limits entry to letters and space character
$(".name").inputmask('Regex', { regex: "[a-zA-Z-`' ]+" }); // Limits entry to letters, -, `, ' and space character 
$(".alphanumeric").inputmask('Regex', { regex: "[a-zA-Z0-9 ]+" }); // Limits entry to letters, numbers and space character
도움이 되었습니까?

해결책

It appears this is related to the IE 7 lookahead bug documented here http://blog.stevenlevithan.com/archives/regex-lookahead-bug Changing the above regex to this resolved the problem (replaced the + with {n,m})

// Due to lookahead bug in IE 7, used {n,m} instead of just +
$(".alpha").inputmask('Regex', { regex: "[a-zA-Z ]{1,50}" }); // Limits entry to letters and space character
$(".name").inputmask('Regex', { regex: "[a-zA-Z-`' ]{1,50}" }); // Limits entry to letters, -, `, ' and space character 
$(".alphanumeric").inputmask('Regex', { regex: "[a-zA-Z0-9 ]{1,50}" }); // Limits entry to letters, numbers and space character
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top