jQuery: Single button click, click event firing two or more times

前端 未结 8 1584
被撕碎了的回忆
被撕碎了的回忆 2021-01-30 13:45

I have HTML input and button elements. I use the buttons to submit forms, open secondary windows, etc. The problem is, a single click is turning into 2 (and sometimes many more

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 14:45

    Calling something like this before it worked for me since I had originally used $('#myButton').on('click'... to assign my listeners.

    $('#myButton').off();
    

    Documentation for "off();"

提交回复
热议问题