Jquery function doesn't work after Ajax call

后端 未结 7 1289
滥情空心
滥情空心 2020-12-09 12:46

I\'ve got this function:

$(document).ready(function() {
$(\'.post_button, .btn_favorite\').click(function() {


//Fade in the Popup
$(\'.login_modal_message\         


        
7条回答
  •  粉色の甜心
    2020-12-09 13:36

    Instead of this:

    $('.post_button, .btn_favorite').click(function() {
    

    do this:

    $(document).on('click','.post_button, .btn_favorite', function() {
    

    on will work with present elements and future ones that match the selector.

    Cheers

提交回复
热议问题