Reputation: 155
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
Upvotes: 0
Views: 1779
Reputation: 155
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
Upvotes: 1