使用tablesorter jquery在表中添加一行

使用tablesorter jquery在表中添加一行,jquery,css,row,tablesorter,Jquery,Css,Row,Tablesorter,我有一个带有jquery库“Tablesorter”的表buil,当我点击一个按钮时,我想在这个表中添加一行,但当我添加该行时,这并不需要Tablesorter的css。。所以我不能选择他,或者css“奇数”“偶数”不起作用 $("#ajouterCodePiece").click(function(){ $('#tablesorter-demo-gauche tr:last').after('<tr'><td>'+$('#codepiece option:sel

我有一个带有jquery库“Tablesorter”的表buil,当我点击一个按钮时,我想在这个表中添加一行,但当我添加该行时,这并不需要Tablesorter的css。。所以我不能选择他,或者css“奇数”“偶数”不起作用

$("#ajouterCodePiece").click(function(){
    $('#tablesorter-demo-gauche tr:last').after('<tr'><td>'+$('#codepiece option:selected').text()+'</td><td>'+$('#mode option:selected').text()+'</td></tr>');
});
$(“#外部代码”)。单击(函数(){

$(“#tablesorter demo gauche tr:last”)。在(“tablesorter将所有表内容存储在缓存中之后,为了告诉tablesorter某些内容已更改,您需要触发更新:

$('table').trigger('update');
这个这个

$(“#外部代码”)。单击(函数(){
$('#tablesorter demo gauche tr:last')。之后('+$('#代码段选项:选定')。text()+'+$('#模式选项:选定')。text()+';
$('#tablesorter demo gauche')。触发器('update');
});

开始时有不匹配的
。在(“..任何像这样的单引号
$(“#代码段选项:选中”)
需要用反斜杠转义或用双引号替换好的,但我的行被添加到表中,但没有库tablesorter的css。例如,如果我添加行==>它被添加到表中,但我不能选择他,而不是css表示“奇数”或“偶数”等等…@user1814879:你能发布生成的html吗,这样我们就可以分析手动将css包含到新行中。你可以在这里看到正在生成的html:第一:如果我添加一行,你可以看到它被添加了,但没有颜色。如果我单击它,我就无法选择一行。$(“#tablesorter demo gauche tr”)。单击(函数(){$(“#tablesorter demo gauche tr”)。不是(这个)。removeClass('hilite');$(这个)。toggleClass('hilite');)));非常感谢。行“奇数”“偶数”起作用,但我无法选择新行。您可以在这里看到它……如果您单击行1或行2,则可以更改要绑定的突出显示函数,如下:
$(“#tablesorter demo gauche”).on(“单击”,“tr”,function(){});
-这是It工作周..谢谢
$("#ajouterCodePiece").click(function () {
    $('#tablesorter-demo-gauche tr:last').after('<tr><td>' + $('#codepiece option:selected').text() + '</td><td>' + $('#mode option:selected').text() + '</td></tr>');
    $('#tablesorter-demo-gauche').trigger('update');
});