0
我有一个2外部jQuery文件一个允许我克隆表的最后一行,而另一个应该允许我抓取基于分配给它的类的选择标记的ID。但它只适用于原始行,并且在克隆行时不起作用。任何帮助将大大appreacated。Jquery和克隆表不工作
JS来克隆最后表行:
$(document).ready(function() {
$("#btn_AddTruck").click(function() {
var $tableBody = $('#tbl_invTruck').find("tbody"),
$trLast = $tableBody.find("tr:last"),
$trNew = $trLast.clone();
// Find by attribute 'id'
$trNew.find('[id]').each(function() {
var num = this.id.replace(/\D/g, '');
if (!num) {
num = 0;
}
// Remove numbers by first regexp
this.id = this.id.replace(/\d/g, '')
// increment number
+ (1 + parseInt(num, 10));
});
$trLast.after($trNew);
});
});
的js通过类来获得选择标签的ID:
$(document).ready(function()
{
$(function(ready){
$('.selectLp').change(function() {
//alert("working" +this.id);
var Lp_Id = this.id;
alert(Lp_Id);
});
});
})
你也可以把HTML? –