Closed doublejosh closed 9 years ago
Able to hack around the issue by only adding the mask once input is present.
$.each($('.form-input__text'), function() {
$(this).on('focus blur change input', function touchedInput() {
if ($(this).val() !== '') {
// Masks.
if ($(this).attr('name') === 'card_num') {
$(this).mask('0000-0000-0000-0000');
}
if ($(this).attr('name') === 'exp_date') {
$(this).mask('00/00');
}
}
});
});
Not great.
If you were able to submit a PR identifying and fixing the problem I would more than happy to merge it.
Float labels are another great input refinement, and should/can be used with an input mask. JVFloat is a popular library. https://github.com/maman/JVFloat.js
The jQuery-MaskPlugin inserts
undefined
into the text field when combined with JVFloat.