2012-11-13 36 views
0

我有了那个消失的onfocus默认值的文本框:文本框的值不刷新

<input data-role="none" class="search-box" id="addressLookupTxt" type="text" value="City and State or Zipcode" onfocus="clearText(this)" onblur="clearText(this)" /> 

输入文本(即90210)和提交值后,当我回到这个页面输入,提交的值仍然存在。

我怎么能刷新这个值,其默认当我回来吗?

$('#CheckInPage').live('pagebeforeshow', function(toPage, fromPage){}); 
+0

你见过这样的回答:http://stackoverflow.com/questions/5496301/input-fields-are-retaining-their-values-after-a-page-refresh-how-to-prevent-tha –

+0

假设它不是自动完成的文本(看看@ComputerArts链接到的问题)你应该能够像下面的$('#CheckInPage')那样设置JS中的文本。live('pagebeforeshow',function(toPage ,fromPage){$('#addressLookupTxt')。val(''); });' – Jack

回答

1

不建议使用jQuery Mobile的使用

<a href="prefetchThisPage.html" data-prefetch> ... </a> 

这会照顾回发页面

看到caching pages

时创建的默认/索引页多页