var table = document.getElementById(table1);
var lastRow = table.rows.length;
var country = lastRow.getElementById('Country');
country.setAttribute('class', "Country"+lastRow);
Run Code Online (Sandbox Code Playgroud)
我很新,我想知道这是否可能?
代替
var Country= document.getElementById('Country');
Run Code Online (Sandbox Code Playgroud)
因为我有其他id = Country因为我正在添加新行..
编辑
我知道身份证是独特的.但是我克隆了最后一行,所以ID当然都是一样的.