如何将单元格附加到js jquery中的表行

时间:2022-09-17 11:37:59
$("#requesttable").append("<center><legend><h2>Remote Stop</h2></legend></center><tr><td><B>Transaction ID</B></td><td><input id='transactionIdremtestop' class='easyui-textbox' name='transactionIdremtestop' style='width:200px;'></td></tr>");

I have to append this code in javascript.

我必须在javascript中附加此代码。

This part is working but html textbox is showing instead of 'easyui-textbox'..how can i make it..to show easyui textbox

2 个解决方案

#1


0  

If I am getting you right, it's just the double quotes that's bothering you. Though I am not sure it works, I am just modifying your own code here:

如果我找到了你,那就是双重引号让你感到烦恼。虽然我不确定它是否有效,但我只是在这里修改你自己的代码:

$("#canclresv").append('<center><legend><h2>Cancel Reservation</h2></legend></center><tr><td><input id="keygetconfig" class="easyui-textbox" name="keygetconfig" style="width:200px;"></td></tr>');

#2


0  

give an id to the table like id="table" then

像id =“table”那样给表提供一个id

 document.getElementById("table").rows[0].insertCell(-1).innerHTML +="whatever you want";

if you want to insert in an already existing cell just use:

如果要插入已存在的单元格,只需使用:

 document.getElementById("table").rows[0].cells[index].innerHTML ="whatever you want";

#1


0  

If I am getting you right, it's just the double quotes that's bothering you. Though I am not sure it works, I am just modifying your own code here:

如果我找到了你,那就是双重引号让你感到烦恼。虽然我不确定它是否有效,但我只是在这里修改你自己的代码:

$("#canclresv").append('<center><legend><h2>Cancel Reservation</h2></legend></center><tr><td><input id="keygetconfig" class="easyui-textbox" name="keygetconfig" style="width:200px;"></td></tr>');

#2


0  

give an id to the table like id="table" then

像id =“table”那样给表提供一个id

 document.getElementById("table").rows[0].insertCell(-1).innerHTML +="whatever you want";

if you want to insert in an already existing cell just use:

如果要插入已存在的单元格,只需使用:

 document.getElementById("table").rows[0].cells[index].innerHTML ="whatever you want";