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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.