Why is the onClick event triggered twice?

前端 未结 10 1261
夕颜
夕颜 2021-02-05 02:40

I have the following html:


    
&         


        
10条回答
  •  不知归路
    2021-02-05 02:59

    I also face this problem on Modal

    Solved by the following tricks -

    $('#saveButton').off('click').on('click', { modal: modal }, save)
    

    Here off('click') prevents the save method fires multiple times.

提交回复
热议问题