jQuery click event handler is called twice for a checkbox

前端 未结 10 1937
野趣味
野趣味 2020-12-09 17:08

I have a problem with the following code in an ASPX page:



        
10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 17:40

    $(document).ready(function() {
        $('.test').click(function(event) {
                        event.stopImmediatePropagation();
                        alert("Click");
                        })
                     }
                  );
    

    I was able to get my code working by stopping the event Propagation. It did not affect the status change of the checkbox.

提交回复
热议问题