开发者

Trying to unbind events on iPad2 with javascript

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 even开发者_运维知识库t 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜