<script type="text/javascript">
$(document).ready(function(){
console.log($('#list_table_template').html());
});
</script>
<div id="list_table_template" style="display: none;">
<table id="list_table" cellpadding="0" cellspacing="0">
<p>123</p>
<tr id="lt_header">
<!--#lt_header#-->
</tr>
<!--#lt_listing#-->
<tr id="lt_footer">
<td colspan="5">Footer Placeholder</td>
</tr>
</table>
</div>
此代碼未返回預期結果。JQuery html()函數與表格無法正常工作
雖然我所期待的日誌顯示:
<table id="list_table" cellpadding="0" cellspacing="0">
<p>123</p>
<tr id="lt_header">
<!--#lt_header#-->
</tr>
<!--#lt_listing#-->
<tr id="lt_footer">
<td colspan="5">Footer Placeholder</td>
</tr>
</table>
,而是它給了我:
<p>123</p><table id="list_table" cellpadding="0" cellspacing="0">
<tbody><tr id="lt_header">
<!--#lt_header#-->
</tr>
<!--#lt_listing#-->
<tr id="lt_footer">
<td colspan="5">Footer Placeholder</td>
</tr>
</tbody></table>
注意p標籤是無序跳在面前的桌子上。