Javascript 填充<;表>;包含HTML的行
我在屏幕上有一张空白表格:Javascript 填充<;表>;包含HTML的行,javascript,html,Javascript,Html,我在屏幕上有一张空白表格: <table id="TransactionTable" class="table table-responsive table-striped"> <thead> <tr> <th></th> <th>Date</th> <th>Account</th>
<table id="TransactionTable" class="table table-responsive table-striped">
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Account</th>
<th>Third Party</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody></tbody>
</table>
但它似乎根本没有添加代码。一旦显示,表中就没有任何内容
我做错了什么?jQuery对象没有
innerHTML
属性-您需要使用html
方法,或者引用jQ对象的0
索引来获取本机DOM对象:
$('#TransactionTable')[0].innerHTML = result.TableCode;
或
if (result.Success == 'true') {
$.unblockUI();
$('#TransactionTable').innerHTML = result.TableCode;
$('#transactions').modal('show');
}
else {
$.unblockUI();
alert("error");
}
$('#TransactionTable')[0].innerHTML = result.TableCode;
$('#TransactionTable').html(result.TableCode);