使用jquery替换特定的tr内容

Nad*_*han 1 php ajax jquery

我有一个表格如下:

<table>
    <tr>...<tr>
    <tr>...<tr>
    <tr class="replace">...<tr>
    <tr class="replace">...<tr>
    <tr class="replace">...<tr>
    <tr>...<tr>
    <tr>...<tr>
</table>
Run Code Online (Sandbox Code Playgroud)

使用jQuery和AJAX,我想<tr>用类名"replace"替换所有内容.

Mar*_*in. 5

只需使用jQuery的方法.html()

$("tr.replace").html('<td>New content comes here</td>');
Run Code Online (Sandbox Code Playgroud)