Reputation: 1082
I have a page in jquery mobile which I fill dynamically per Javascript with HTML.
If the user goes to another page, I want to clear the dynamically added html-content from the page.
With the .remove()
method, the whole page will be removed from the web-application.
Upvotes: 0
Views: 2774
Reputation: 57309
Just use function empty()
on a data-role="content"
DIV and do it during the pagehide
event.
Working example:
$(document).on('pagehide', '#index', function(){
$('[data-role="content"]').empty();
});
In this case #index
is a page id.
Upvotes: 1