I'm trying to load javascript using jquery .live() and binding it to pageshow. However, this doesn't work with IE (figures!), is there a compatible event I can bind to for IE?
$(".root").live('pageshow', function(event, ui) {
alert("HERE");
});
See this answer by 'thorie' to a similar issue. His idea of checking a hidden field (dirty bit) works in IE and Chrome. Then you add in a seperate line to work in Firefox; bind to pageshow
and check event.originalEvent.persisted
.
I may be two years too late to help you, but hopefully someone else may find this of use (or I will be corrected for my idiocy perhaps?!).
$('#mypage').live('pageshow', function (event, ui) {
it should work
Try to give id instead of class name of element u are referring for pageshow
The pageshow event is not recognized by IE, it wont fire. JQuery already has the solution, the ready handler
$(document).ready(function(){ //your code })
or the shorter version, which is the same thing
$(function(){ //your code })
If you really want to use pageshow in a cross-browser way, trigger it from within ready
$(function(){
$(document).trigger("pageshow")
})
and handle the pageshow event using your handler