Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery live event on iPad...why doesn't it work?

Tags:

jquery

ipad

I'm using jQuery to develop webapps on the iPad and it seems the jQuery live event doesn't work... This was the case when I was working with the SDK iPad emulator and now that I have the iPad to work on, its still the same (I was hoping it was an emulator fault). Running the same code on a web kit build works fine.

I'm just wondering if anyone else is having this problem? If there is a fix? or if it's me? Hoping someone can help as my code is becoming really bloated having to rebind clicks etc after ajax calls.

Thanks :)

like image 493
Dave Avatar asked Jul 27 '10 15:07

Dave


1 Answers

The issue is for some reason mobile safari does not attach the click events to some DOM elements, So you have to manually attach them.

$('.header').live('click',get_location_input);

and when you add this later it works on the ipad

<div class='header' onclick=''>Station Info</div>

here is where I got my information

http://skillfulness.blogspot.com/2010/11/workaround-for-jquery-live-event.html

like image 132
samccone Avatar answered Nov 09 '22 22:11

samccone