2016-10-04 19 views
0

私はログイン後にHTML上でテキストフィールドを空にしようとしています。私がログアウトすると、私が挿入したデータはまだそこにあります。それ、どうやったら出来るの?ここにあなたの助けに感謝して、私のhtmlです。[送信]ボタンをクリックした後、テキストフィールドを更新するにはどうすればよいですか?

<div class="tabs-striped tabs-background-positive tabs-color-light"> 
    <div class="tabs"> 
     <a class="tab-item active" href="#/app/login"><i class="icon ion-unlocked"></i> Login</a> 
     <a class="tab-item" href="#/app/signup"> <i class="icon ion-person"></i> Sign Up </a> 
    </div> 
</div> 

<ion-view view-title="Sign In" class="loginBg" hide-nav-bar="true" > 

    <ion-content class="padding"> 

    <div class="row responsive-sm padding remvoeBP"> 
     <div class="col"> 
      <center><img src="img/logo.png" alt="Item Img" width="275" height="90"></center> 
      <br> 
      <div class="list list-inset"> 
       <label class="item item-input"> 
        <input type="text" id="phone" placeholder="Phone Number" ng-model="user.phone" ng-maxlength="13" onkeypress='return event.charCode>=48 && event.charCode<=57' required autocomplete="off"> 
       </label> 

       <label class="item item-input"> 
        <input type="password" id="pin" placeholder="PIN" ng-model="user.pin" ng-maxlength="6" onkeypress='return event.charCode>=48 && event.charCode<=57' required autocomplete="off"> 
       </label> 
      </div> 

      <div class="loginButton"> 
       <button class="button ion-unlocked button-block button-positive" ng-click="login();" > 
        Login 
       </button> 
      </div> 
     </div> 
    </div> 

    </ion-content> 
</ion-view> 
+0

[オートコンプリート](http://www.w3schools.com/tags/att_input_autocomplete.asp)属性を使用します。 –

+0

@RohitKishore私はすでにそれを使用していました –

答えて

0

あなたはこのようにjQueryを使用して試すことができます:

<script> 
$(document).ready(function(){ 
$('form').each(function() { 
this.reset() 
}); 
}); 
<script> 
0

あなたはjqueryの使用を使用している場合、これは:

あなたがして、フォームをリセットすることができます - $("#myform")[0].reset(); または

$('#form-id').children('input').val('') 

JavaScriptを使用している場合:

<input type="button" value="Submit" id="btnsubmit" onclick="submitForm()"> 

function submitForm() { 
    // Get the first form with the name 
    // Hopefully there is only one, but there are more, select the correct index 
    var frm = document.getElementsByName('contact-form')[0]; 
    frm.submit(); // Submit 
    frm.reset(); // Reset 
    return false; // Prevent page refresh 
} 

希望しました。

可能な重複:How do i clear the previous text field value after submitting the form with out refreshing the entire page

関連する問題