problem with jquery mask in dynamic form

1

Well I've set up a dynamic form where I have the 'input' plots. It has already loaded 1 value.

I have another 'input' called value, where I use the jquery mask. It works however when I change the value of the 'input' portions are created other 'input' value, and the mask stops working.

I do not have an error log in the console. Follow me code:

<script>
        $(document).ready(function () {
            $('.valores').mask('00.000.000,00', {
                reverse: true
            });
        });
    </script>  

Does anyone know what it can be?

    
asked by anonymous 23.01.2017 / 18:04

1 answer

1

You will have to load the function every time you add an input (modify the DOM), so use $(document).bind('DOMSubtreeModified', function(){ }); :

<script>
    $(document).bind('DOMSubtreeModified', function () {
        $('.valores').mask('00.000.000,00', {
            reverse: true
        });
    });
</script>  
    
23.01.2017 / 18:36