2013-06-20 39 views
0

我有一个页面在jquery手机,我动态填充每个JavaScript与HTML。清除页面 - jQuery的手机

如果用户转到另一个页面,我想清除页面中动态添加的html内容。

使用.remove()方法,整个页面将从Web应用程序中删除。

+0

取决于您使用的选择器。 –

回答

1

只需使用功能empty()data-role="content" DIV和pagehide事件中做到这一点。

工作例如:

$(document).on('pagehide', '#index', function(){ 
    $('[data-role="content"]').empty(); 
}); 

在这种情况下#index是页ID。