|
I'm having a weird issue but it's probably something easy I've overlooked. I have a calendar form with two submit buttons, so users can add/remove date ranges. I have a debug alert() in there, the whole thing works but the first time, the alert pops once, the second time you click, it pops twice, etc. It looks like I'm adding a handler every time there's a click and they stack or something like that, right? Maybe I'm doing it wrong and I shouldn't bind on the form buttons AND on the submit? code:
|
# ¿ Sep 21, 2010 17:42 |
|
|
# ¿ Apr 25, 2024 21:14 |
|
Lumpy posted:Each call to .click() ADDS a handler. The little snippet you posted doesn't look like it's adding multiple handlers, but you truncated it so maybe it's somewhere else. To avoid dupe handlers you can do something like: Ah, I see my error, it wasn't with the buttons click()! I register ajaxComplete() inside the submit() call, so that one would stack each time an AJAX call was made (for every form submit). I seem to have fixed it by doing what you did, but for ajaxComplete(): code:
|
# ¿ Sep 21, 2010 18:28 |