I have a table in which I have editable data. Each 'editable' section covers two table rows.
<table>
<tr data-doc_id2='doc_id2'>
</tr>
<tr></tr>
<tr data-doc_id2='doc_id2'>
</tr>
<tr></tr>
<tr data-doc_id2='doc_id2'>
</tr>
<tr></tr>
<tr data-doc_id2='doc_id2'>
</tr>
<tr></tr>
</table>
(Please note I haven't put the <td></td> in....)
My jQuery so far is as follows. This will replace the first row with the relevent ID. I am having trouble selecting the second row... next() seems to be looking for the next row that has the ID.
var new_row="<tr data-doc_id2='"+doc_id+"'>
<td>"+doc_name+"</td>
<td>"+first_ins4+"</td>
<td>"+job_price4+"</td>
<td>"+tender4+"</td>
<td><a class='edit_docs' href='javascript:void(0);'>Edit</a> | <a class='del_doc' href='javascript:void(0);'>Delete</a></td>
</tr>";
var new_row2="<tr><td colspan='4'>"+second_ins4+"</td><td></td></tr>";
var row_to_change=$("tr:[data-doc_id2='"+doc_id+"']");
$(row_to_change).replaceWith(new_row);
-and_, added a2, and prepended a:to the selector, but that shouldn't select the first row either.