Forums

  • # January 31, 2013 at 5:03 am

    Hey!
    I have a problem with my JS code:

    I want to achieve that every element with the class .activity is removed. What I do is:


    $(".activity").each(function() {
    $(this).remove();
    })

    Basically this works fine the first time. But as the one .activity is removed, I append a new one. And the .remove() function does not work there.

    I saw that there is a method .live() (.on()), but this takes an event like a click. I have no event; I just want to select every appended element and remove it then.

    # January 31, 2013 at 5:16 am

    I do an ajax request loading new data. With this data there come new activities. So i want to remove the old ones and add the new ones.

    I hope this is clearer now :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag