简体   繁体   English

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

[英]how to append a cell to a table row in js jquery

$("#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>");

我必须将此代码附加到javascript中。

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

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>');

give an id to the table like id="table" then 给表一个id像id =“ table”然后

  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"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM