我想从模板克隆一行,与选定的值。我也想复制后克隆模板行。克隆表行与下拉不起作用
$("CloneButton").click(function() {
var clonedRow = $('#rowtemplate').clone();
clonedRow.html($(clonedRow).html().replace(/#/g, index));
clonedRow.find('.project').text(project);
clonedRow.find('.billingcodeCssId').val(timeCodeID);
clonedRow.find('.billingcodeCss').text(timeCode);
$('#Maintable').append(clonedRow.find('tr'));
});
当我尝试clone the table row JS Fiddle时,选择器没有选取选择器。 选择器有什么问题,并且如何用选择的值下拉克隆该行?
改变'$( “CloneButton”)'到'$( “#CloneButton”)' – aje
@ aje我修正了这个选择器,但它仍然不起作用, – transformer
直到'index','project'等被定义之后,click处理器才被抛出。 你也缺少'$'(“#CloneButton”)。 –