igorescobar / jQuery-Mask-Plugin

A jQuery Plugin to make masks on form fields and HTML elements.
http://igorescobar.github.io/jQuery-Mask-Plugin/
Other
4.77k stars 1.42k forks source link

Bug when use setInterval. #705

Open drafenous opened 5 years ago

drafenous commented 5 years ago

Hello I'm using the latest version of the plugin, but when I'm going to use setting up in a 1000ms setinterval, the mask bug, and I can not display the formatting in cash...

My code: `
setInterval(() => { realTimeHeaders(); )}, 10000);

function realTimeHeaders(){
    $.ajax({
        url: '<?= base_url("assets/src/json/dashboard-headers.json"); ?>',
        cache: false,
        dataType: 'json',
        success: (response) => {
            $('#faturamentoGeral0').html(response['faturamentoGeral'][0]);
            $('#faturamentoGeral1').html(response['faturamentoGeral'][1]);

            $('#faturamentoSP0').html(response['faturamentoSP'][0]);
            $('#faturamentoSP1').html(response['faturamentoSP'][1]);

            $('#faturamentoFSP0').html(response['faturamentoFSP'][0]);
            $('#faturamentoFSP1').html(response['faturamentoFSP'][1]);

            $('#headers .money').mask(window['globalSettings'].defaultMoneyMask, {reverse: true}).trigger('keyup');
            return response;
        },
        error: (response) => {
            return console.error(response);
        }
    })
}`

Thanks alot!