Javascript 在运行时使用jquery准备表体会导致设计问题

Javascript 在运行时使用jquery准备表体会导致设计问题,javascript,jquery,html,Javascript,Jquery,Html,表行和数据的格式不正确 这是问题的关键环节 下面是HTML代码 <table border="1" style="width: 100%" class="eventtable"> <thead style="color: blue"> <tr> <th>#</th> <th>Field Name</th> </tr&g

表行和数据的格式不正确

这是问题的关键环节

下面是HTML代码

<table border="1" style="width: 100%" class="eventtable">
    <thead style="color: blue">
        <tr>
            <th>#</th>
            <th>Field Name</th>
        </tr>
    </thead>
    <tbody id="tblEntity"></tbody>
</table>

#
字段名

您将
td
和输入(以及
figure.text
)添加到
tr
,因为
tr.append(“”
再次返回
tr
)可链接性

正确的代码可能如下所示:

// Adding the input into the row
tr.append("<td>").find('td').append(input);

// Your text
tr.append("<td>").find('td').append(Column.figure.text);
$("<td>").appendTo(tr).append(input);
和var tr=$('tblEntity')。append('')将$('tblEntity')赋值给变量tr