tags:

views:

26

answers:

1

I have an jquery script using .ajax that loads a new div containing the replied information. Part of the contents of that div is a link that says remove. When remove is clicked I want the parent div to hide. This doesn't seem to work.

$(document).ready(function(){
  $('.remove').click(function() { 
    $('.remove').parent().hide();
  });
});

This has no effect what so ever. This code seems to work if the div I am trying to work with isn't loaded with ajax. Any ideas?

+2  A: 

Try live (added in 1.3):

$(document).ready(function(){
      $('.remove').live('click', function() {
          $('.remove').parent().hide();
      });
});

Man: http://api.jquery.com/live/

Thanks! That did the job.
Boogada