通过 jQuery 追加 table
Append table via jQuery
我正在尝试在加载过程结束后自动将 table 添加到报告中。我尝试在报告 (context.$report):
上使用 jQuery .append() 方法
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-after-build') {
context.$report.append( "<table>...</table>" );
}
}
不幸的是,什么也没发生。我做错了什么?
您的代码是正确的,但仍应加强一点。
试试这个:
举报JavaScript
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-after-build') {
context.$report.find('table#custom').remove()
context.$report.find('.ic3-report-content-container')
.append('<table id="custom"><tr><td>Table</td></tr></table>')
}
}
举报CSS
table#custom {
border: 1px solid #black;
position: absolute;
top: 0;
}
我正在尝试在加载过程结束后自动将 table 添加到报告中。我尝试在报告 (context.$report):
上使用 jQuery .append() 方法function consumeEvent( context, event ) {
if (event.name == 'ic3-report-after-build') {
context.$report.append( "<table>...</table>" );
}
}
不幸的是,什么也没发生。我做错了什么?
您的代码是正确的,但仍应加强一点。
试试这个:
举报JavaScript
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-after-build') {
context.$report.find('table#custom').remove()
context.$report.find('.ic3-report-content-container')
.append('<table id="custom"><tr><td>Table</td></tr></table>')
}
}
举报CSS
table#custom {
border: 1px solid #black;
position: absolute;
top: 0;
}