jQuery: Can't select just appended element

前端 未结 7 1595
天涯浪人
天涯浪人 2021-02-18 13:55

This is what happens on event:

$(\'div#pages\').append($(\'
...
\'));

And then, on another eve

7条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-18 14:39

    You just need to use live method:

    $('.element').live('click', function(){
       alert($(this).html());
    });
    

提交回复
热议问题