If you try this snippet on desktop, everything works.
Whenever you try it on iPad, it won't do anything.
Simple .click()
handler works, but it isn't what I want. The same applies for .delegate();
and .live()
Is it a bug or something?
It's a Safari mobile bug/feature : click events won't bubble all the way up to body.
Adding onclick=""
is a known workaround, but IMHO it's easier to attach your listener on a first child of <body>
.
See: http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html