Reputation: 5588
I try to set initial value with jQuery Mask but the docs doesnt say correct way to it. I tried the next steps
const options = {
onKeyPress: (cep, e) => this.onChangeHandler(e),
default: initialValue
}
$('#id').mask(maskPattern, options);
also
$('#id').mask(maskPattern, options);
$('#id').masked(initialValue);
But neither ways dont work.
I found a work around
$('#id').val(initialValue).trigger('input');
at github issues and im going to share it in the answers, but i'm looking for the genuine way
Upvotes: 0
Views: 1572