Try using: $(this).parents('tr:eq(0)')
or if using jQuery 1.3 or newer, you can use this one too: $(this).closest('tr') On 24 mar, 10:59, lionel28 <lmarte...@haitiwebs.net> wrote: > Hello, I am trying to remove an entire tr row. > > Please, someone help me. > This is what I use > > ############################# > $(document).ready(function() { > $('a.delete').click(function(e) { > e.preventDefault(); > var parent = $(this).parent('td').parent('tr'); > $.ajax({ > type: 'get', > url: 'delete.php', > data: 'ajax=1&delete=' + parent.attr('id').replace('image-',''), > beforeSend: function() { > parent.animate({'backgroundColor':'#fb6c6c'},300); > }, > success: function() { > parent.slideUp(300,function() { > parent.remove(); > }); > } > }); > }); > > }); > > #################### > in the tr, I have the id. And in the td contents I have a link plus a linked > image of a trash bin with the class="delete". The idea is when you click on > image it's supposed to remove entire tr with contents. > ##################### > > The only way I got it to work is to use use var parent = $(this).parent(); > and place the id in a div and remove the linkage in the file and wrap around > the entire linked image with a class="delete", the text , the image > > ----------------------------------------- > I really need to keep the other link. > > so please what would be the correct syntax to get the tr? > > var parent = $(this).parent('td').parent('tr'); does not work for me. > > Thank you > -- > View this message in > context:http://www.nabble.com/Deleting-an-entire-tr-tp22677143s27240p22677143... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.