'appendChild'on 'Node':参数1不是'Node'向表
本文关键字:Node 不是 向表 参数 appendChild on | 更新日期: 2023-09-27 18:03:13
我的代码如下:
var counter = 3;
function AddAddressRow() {
var newRow = jQuery('<tr><td><div>' +
'<select class="dropdown-wrap k-rtl " id="ddlPrefix' +
counter +
'_1" style="width: 100px;">' +
'<option value="option1" selected="selected">Option 1</option>'+
'<option value="option2">Option 2</option>' +
'</select> <br /><br/></div></td><td><div>' +
'<select class="dropdown-wrap k-rtl " id="ddlPrefix' +
counter +
'_2" style="width: 100px;">' +
'<option value="option1" selected="selected">Option 1</option>' +
'<option value="option2">Option 2</option>' <
+'/select><br /></div></td><td><input style="width: 100px;"
id="txtAddress' + counter+'"/><br/><br/></td></tr>');
counter++;
$("table#AddressTable").append(newRow);
}
点击下面的按钮
<button onclick="AddAddressRow();">+</button>
I caught TypeError:
在'Node'上执行'appendChild'失败:参数1不是'Node'类型
newRow没有返回tr节点。查看此处
或者试试这样:
var tr_ele = document.createElement('tr');
tr_ele.innerHTML = '>html here..<';
$("table#AddressTable").append(tr_ele);