我试图使用
jquery在HTML表格的单元格中插入行,我想要这样的东西:
--------------
ID | Sec | Div
--------------
1 | S1 | D1
| S2 | D2
| S3 | D3
--------------
2 | S3 | D3
| S4 | D4
| S5 | D5
--------------
这是我到目前为止:
function insertRows(this){
var Rows1 = '
S1 S2 S3 'var Rows2 = '
S3 S4 S5 'this.srcElement.parentElement.nextSibling.outerHTML = Rows1
this.srcElement.parentElement.nextSibling.nextSibling.outerHTML = Rows2
}
它的作用是,它将所有内容插入到同一行中,如下所示:
---------------------
ID | Sec | Div
---------------------
1 | S1S2S3 | D1D2D3
---------------------
2 | S3S4S5 | D3D4D5
---------------------
我怎样才能使这个工作?