jQuery to find previous elements
- by mike
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(' ');
$(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