Possible Duplicate:
jQuery: prev(<selector>) not working?
Consider this markup:
<tr class="store">
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td><a href="#" class="link">link</a></td>
</tr>
Then this Jquery code:
$('.link').live('click', function() {
$(this).parents('tr').prev('.store').remove();
});
What I want to do is when I try to click <a href="#" class=".store", the previous <tr class="store"> should be removed. The Jquery code I posted doesn’t work. Any thoughts?
Try demo: