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
for me it was caused by
$(function() {
$('.some-element').click(function() {
//event that fires twice
});
//some exception-throwing code here
});
jQuery was calling the anonymous ready function twice(?!) because of the exception so the click function would be bound twice.
I had a problem with modal dialog windows. The event fired once for each time I had opened a dialog in the session. No problem on the first window, fired twice on the second window, fired three times on the third window, etc.
I found that the initialization function for the dialog was being called each time I opened a new dialog window in the same session. I added a global variable notInit = -1 and assigned the value to 1 when running init. I checked the value of notInit before running the init function and only proceeded with init if the value was -1.