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

三世轮回 提交于 2020-01-22 14:17:05

问题


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 :)


回答1:


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




回答2:


I had to use the jQuery .delegate event which seems to do the trick binding click to an element after an ajax call.




回答3:


'cursor: pointer' for the perticular ID in css file works for me..



来源:https://stackoverflow.com/questions/3344960/jquery-live-event-on-ipad-why-doesnt-it-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!