Reputation: 897
I'm trying to change two table cell(td) values based on if one of the tds has a checkbox that is selected. I'm trying to change the 3rd and 4th tds in the table row. I can change the td that contains the checkbox, I just can't change the text of the td to the left of it.
Js
//this event is triggered after a form submit
$('#frm input:checkbox:checked').each(function () {
// change 4th column text - this works
$(this).closest('td').html("test");
// change 3rd column text - can't seem to select this td
$(this).closest('td').parent('tr').eq(2).html("test");
});
Upvotes: 1
Views: 36
Reputation: 7559
If $(this).closest('td') gives you the 4th td, $(this).closest('td').prev() should give you the third.
Upvotes: 1