2014-04-23 64 views
-1

jquery mobile popup在每次打開彈出窗口時都會在我的文本框中加載相同的舊值。如何加載清除數據的新彈出窗口。 以下是我的彈出窗口的HTML。jQuery Mobile Popup加載相同的舊值

<a href="#popupLogin" data-rel="popup" data-position-to="window" data-role="button" data-inline="true">Form</a> 
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all"> 
      <form> 
       <div style="padding:10px 20px;"> 
        <h3>Please sign in</h3> 
        <label for="un" class="ui-hidden-accessible">Username:</label> 
        <input type="text" name="user" id="un" value="" placeholder="username" data-theme="a" /> 

        <label for="pw" class="ui-hidden-accessible">Password:</label> 
        <input type="password" name="pass" id="pw" value="" placeholder="password" data-theme="a" /> 

        <button type="submit" data-theme="b">Sign in</button> 
       </div> 
      </form> 
     </div> 
+3

這裏是jQuery代碼? –

+1

問題很明顯,我不知道你爲什麼發現它不清楚? – Omar

回答

2

您需要在任popupbeforepositionpopupafteropen事件彈出內復位輸入。

$(document).on("pagecreate", "#pageID", function() { 
    $("#popupLogin").on("popupbeforeposition", function() { 
     $("input", this).val(""); 
    }); 
}); 

Demo