I am creating an application by jQuery Mobile.
I want a link, which redirects to a page. for example:
<a href="/Account/" data-transition="turn" class="useroptions">Account</a>
It is available on all of pages, and I want to change href of that link on every page to something like this:
<a href="/Account/?returnUrl=http%3A%2F%2Fexample.com%2FAbout" data-transition="turn" class="useroptions">Account</a>
I have written this code, but it is not working when jQuery Mobile loads a page with Ajax navigation:
$(function () {
$(".useroptions").attr("href", "/Account/?returnUrl=" + encodeURIComponent(document.URL));
});
How to do that when every page is shown? (Which event should I use? …)
I should use
pageshowevent of jQuery Mobile. seepageshowpart of this page.Modified version of jQuery code to work correctly: