I use $(document).ready to fire the event. However, it works fine with IPHONE4S and IPHONE5S(both runs 7.1.1). But on IPHONE5(7.1.1), it doesnt fire at all.
When i change to window.onload, all work fine.
This confused me as all the IPhones are running exactly the same iOS. Why only IPHONE5 doesn't work with $(document).ready? Is this a bug of JQuery or iOS?
$(document).ready(
function(){
alert("fired");
});
window.onload=function(){
if(navigator.userAgent.match(/iPhone/i))
alert("fired");
}
Try the jQ plugin jQuery mobile or an older version of jQuery. jQ 1.6+ is known to cause problems on Safari/iPhone. I think it isn't a "bug", rather some special support of mobile devices is outsourced to a plugin in order to keep the the core slim.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.