I have a custom web dashboard that relies heavily on jQuery, jQuery UI, and jquery-ui-touch-punch. Everything works except for click events on dynamic content (js added elements) on an iPad.
So this works everywhere
$('.foo').click( function() {
//whatever
});
but events on dynamic content doesn't work on an iPad, like this
$('body').on('click', '.foo', function() {
//whatever
});
The dashboard monitors stuff in real-time, so events on dynamic elements are a must. Any ideas on how to fix?
I tried delegate() as per @elzi's answer, but it didn't work. Saw bind() in the jquery documentation in the same breath as on() and delegate(), tried it and it works!!
$( ".foo" ).bind( "click", function() {
//whatever
});