jQuery $(this).remove() not working after append

后端 未结 2 1030
太阳男子
太阳男子 2021-01-02 03:46

I have a div with class=\"tags\" with one predefined hyperlink.

myLink
2条回答
  •  暖寄归人
    2021-01-02 04:31

    You have to use the live-function:

    $(".tags a").live("click", function() {
        // ...
    });
    

    Because you are adding the links after the initial load, the standard click event won't be binded to the dynamic added links.

提交回复
热议问题