Jquery 'click' not firing when icon is on button

前端 未结 3 1260
Happy的楠姐
Happy的楠姐 2021-01-19 14:17

I use Bootstrap and jQuery. I have three buttons, each with an icon in it. When I bind an click-event to a button, it works when I cli

3条回答
  •  离开以前
    2021-01-19 14:53

    You need a different syntax, as per the documentation:

    $('body').on('click', 'button.btn_change_status', function(e) {
       alert(e.target.id);
       return false;
    });
    

提交回复
热议问题