我用jquery追加功能创建复制行,使用它的添加和删除按钮,表格的第一行内有jquery掩码用于手机输入。
手机掩码工作第一行,但副本行不起作用。
$(document).ready(function(){
var cnt = 2;
$(".addCF").click(function(){
$("#customFields").append('<tr><td><input type="text" name="adsoyad[]" style="width:130px"/></td><td><input type="text" name="gorevi[]" style="width:130px"/></td><td><input type="text" id="phone" name="telefon[]" style="width:130px"/></td><td><input type="text" name="dahili[]" style="width:70px"/></td> <td><input type="email" name="eposta[]" style="width:190px"/></td><td><a href="javascript:void(0);" class="remCF"><span class="btn">-</span></a></td></tr>');
cnt++;
});
$("#customFields").on('click','.remCF',function(){
if (confirm("Silmek istediğinizden emin misiniz?"))
{
$(this).parent().parent().remove();
}
});
});
jQuery(function($){
$("#phone").mask("(999) 999-9999");
});
http://jsfiddle.net/drxman/hqgenthu/2/
附加新行后,您必须重新附加手机掩码。