How can I apply a dynamic mask in an dynamic form?

前端 未结 2 413
孤独总比滥情好
孤独总比滥情好 2021-01-16 22:06

I have a problem with my dynamic form. This input is:



        
2条回答
  •  不知归路
    2021-01-16 22:34

    Pamio is on the right track. But appending the script to the page doesn't seem to work(?). The following works for me:

    $('#plusPhone').click(function(){
       var HTML = 'this contains an input field with the class you want to mask';
       jQuery('#element-you-want-to-append-to').append(HTML);
       jQuery('.class-you-want-masked').mask('99-99-9999');
       //Just call the mask AFTER appending the input, and it should be applied.
    )};
    

提交回复
热议问题