How to dynamically change mask?

flashfs 12 Sep, 2017
Using 6.0.9 and I'd like to know if is there any possibility to change an input mask dinamycally, say from a JS code. I already tried to use something like jQuery("#id").data("inputmask", "99-99") but the form doesn't update itself.
flashfs 15 Sep, 2017
Answer
1 Likes
This was the only way I've found that worked:

jQuery("#id").attr("data-inputmask", " 'mask' : '999.999.999-99' ");
jQuery("#id").inputmask();

I don't know why .data() didn't work.
By the way, to inputmask() works, you have to write a dummy mask on Advanced > Extra attributes, so the script jquery.inputmask.bundle is loaded:

data-inputmask: 'mask' : ''
This topic is locked and no more replies can be posted.