views:

51

answers:

2

Hi everybody, I have the following table

<table>
<tr class="ligneI">
<td class="col2b"><input type="text" id="desc" class="calcule"></td>
<td class="col2b"><input type="text" id="price" class="calcule"></td>
<td class="calculated_price">220.00</td>
<td class="calculated_price">1800.00</td>
<td><a title="" class="picto06 deleteLink" id="deleteLink1" href="#" onclick="resetfields(this);">delete</a></td>
</tr>
<tr class="ligneI">
<td class="col2b"><input type="text" id="desc" class="calcule"></td>
<td class="col2b"><input type="text" id="price" class="calcule"></td>
<td class="calculated_price">87.00</td>
<td class="calculated_price">40.00</td>
<td><a title="" class="picto06 deleteLink" id="deleteLink2" href="#" onclick="resetfields(this);">delete</a></td>
...

and I would like to reset the entire when i click on a delete link.

I tried to do something like this:

function resetfields(obj)
{
    $(this).parent().prevAll('td.calcule').html('&nbsp;');
    $(this).parent().prevAll('td input.calcule').val('');
}

but only the first line erase the two first befor my link. Someone can help me please.

Ps : excuse my english

+1  A: 

Please try this:

$(this).parent().parent().find('td.calculated_price').html(""); //doing parent().parent() to get to TR
$(this).parent().parent().find('td.calcule').val("");

HTH

Raja
thanks,this code works great$(this).parent().parent().find('td.calculated_price').html(""); $(this).parent().parent().find('tdinput.calcule').val("");
mike
+1  A: 

Try this:

$(this).closest('tr').find('td.calculated_price').html('&nbsp;');
$(this).closest('tr').find('td input.calcule').val('');
Jon
thanks!That's work great
mike