User970008 User970008 - 4 months ago 22x
jQuery Question

Jquery events on Jquery Mobile Page After Postback

After a form postback, none of the standard Jquery events or functions fire.

I have a search page that posts to itself. Jquery Mobile Ajax loads the search results content, and the page elements are no longer bound. The page hash does not change.

$(document).on('pageshow', '#SearchPage', function (e, data) {
console.log("This message fires on postback");

//hide only works the first time

//does not give accurate results on postback
var hasSearchResults = $("#SearchWrapper").hasClass("results");


What do I have to do to use standard show(), hide(), or hasClass() functions after a postback?

I am using Jquery Mobile 1.4.5.


I had to switch to classes instead of IDs.


It doesn't seem to like to rebind using an ID.