Bind JavaScript jQuery click event on label AND on checkbox simultaneously

前端 未结 2 905
夕颜
夕颜 2021-01-11 10:54

I\'m using labels for my form, like this :



2条回答
  •  独厮守ぢ
    2021-01-11 11:12

    Instead of binding with the click() event, you should bind using the change() event, then however this change is triggered the outcome will be the same:

    $('#foo').change(
        function(){
            // do whatever
        });
    

    References:

    • change().

提交回复
热议问题