2012-11-13 80 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

時創建的默認/索引頁多頁