Solve the problem that jquery listens to the click event and only listens to it once

jquery listens to click events

1. jquery code

		     //只能监听到1次
			$("#gvYB_btnAdd").click(function () {
    
    
                console.log("1111111111111111111");
            });
             //只能监听到1次
            $("#gvYB_btnAdd").on("click", function () {
    
    
                console.log("2222222222222222");
            });
            //只能监听到1次
            $("#gvYB_btnAdd").bind("click", function () {
    
    
                console.log("3333333333333");
            });
            //可以实时监听到多次
            $(document).on("click", "#gvYB_btnAdd", function () {
    
    
                console.log("4444444444444");
            });

2. Input log

insert image description here

Guess you like

Origin blog.csdn.net/vaecnfeilong/article/details/128957339
Recommended