我希望结果必须是这样的,
<tr class="tr_cond">
<td>BLA</td>
<td>BLA</td>
<td>BLA</td>
<td>BLA</td>
<td><input type="button" class="tr_condition" value="+" name="add"></td>
</tr>
<tr class="tr_cond" id="tablCond1">
<td id="tablCond1>BLA</td>
<td id="colCond1>BLA</td>
<td id="operCond1>BLA</td>
<td id="valCond1>BLA</td>
<td><input type="button" class="tr_condition" value="+" name="add"></td>
</tr>
<tr class="tr_cond">
<td id="tablCond2>BLA</td>
<td id="colCond2>BLA</td>
<td id="operCond2>BLA</td>
<td id="valCond2>BLA</td>
<td><input type="button" class="tr_condition" value="+" name="add"></td>
</tr>
<tr class="tr_cond">
<td id="tablCond3>BLA</td>
<td id="colCond3>BLA</td>
<td id="operlCond3>BLA</td>
<td id="valCond3>BLA</td>
<td><input type="button" class="tr_condition" value="+" name="add"></td>
</tr>
jQuery是,
$(".tr_condition").live('click', CloneCondition);
var cloneCount = 1;
function CloneCondition(){
$(this).closest('.tr_cond')
.clone()
.attr('id', 'tablCond'+ cloneCount++)
.insertAfter(".tr_cond:last");
}
正在克隆行,但我想更改行内这些字段的 id,但这只会更改行的 id。