1

Bit of background, we are creating an html5 'app' for the iPad, which has everything contained in a single page, and all the content is dynamic.

I have a dynamically generated anchor, which then has a click event bound to it as so:

 $j(toElement).find(".moveSlideUp").bind('click', addSlideToPresentation_click);

This all works fine, however the problem is that once we navigate away from that page/section, and navigate back to it, the event handler is bound a second time, and thus fires twice (or 3 or 4 times etc...).

I have tried calling unbind before binding, but this makes no difference - any ideas?

Stuart.Sklinar
  • 3,605
  • 4
  • 34
  • 83

1 Answers1

0

You can bind handler in the same context which when is reloaded releases your handler as well. Or check if handler is already bound:

jquery check if event exists on element

test if event handler is bound to an element in jquery

Community
  • 1
  • 1
Jan Pfeifer
  • 2,316
  • 24
  • 32