How to bind event to dynamically added button?

Add a click event to the dynamically added button (you cannot use the click event directly)

// 给class=‘c-btn-cancle’ 的标签添加点击事件:
$(document).on("click", '.c-btn-cancle', function () {
    
    
    // todo
});

Note: Use the listener event on to dynamically add events to the label with class = 'c-btn-cancle' when it is detected.
The click() method can only add click events to existing labels.

Guess you like

Origin blog.csdn.net/weixin_40307206/article/details/109897233