jQuery-Mask-Plugin icon indicating copy to clipboard operation
jQuery-Mask-Plugin copied to clipboard

<td>Programaticaly appended wont mask

Open ctpaula opened this issue 5 years ago • 2 comments

Searched a lot on Git, on Docs and don't found anything that helped me. I know the mask work on "td" but I need to add a td when a button is clicked, in this case, the mask just dont work. What I need to do?

Made this jsfiddle with one example took from this issue (https://github.com/RobinHerbots/Inputmask/issues/1110) but put my problem in the button "tst".

https://jsfiddle.net/6w48vdej/

ctpaula avatar Mar 07 '19 22:03 ctpaula

Hi, I think you need unmask before create a new obj, see code

$("#tstbtn").click(function(){ $(".mask-date").unmask(); $("#teste").append('

930915'); $(".mask-date").mask("99/99/99"); });

shayckspear avatar Jan 21 '20 08:01 shayckspear

Just re-apply the mask inside the event:

$("#tstbtn").click(function(){
	$("#teste").append('<tr><td class="mask-date">930915</td></tr>');
        $(".mask-date").mask("99/99/99");
});

luis-fss avatar Feb 27 '21 17:02 luis-fss