"showPw"スパンを "userPw"の値に置き換えたいのですが、パスワードを変更する際に設定されたprofilePasswordを使ってこれをしようとしています。JQueryの変数にスパンを置き換えてください
ページは1が以前に設定されていないことを発見した場合、それは現在0000
あるDefaultPassword値を持参してくださいが、それだけで999値を示し、それは更新されません。私は "userPw"の値をテストしましたが、それはアラートで正しく表示されますが、それとdefaultPasswordなど...どんなアイデアですか?ここで
のJavascriptです:
changePassword: function(page){
var profilePassword = window.localStorage.getItem("userPw");
var defaultPassword = "0000";
if(!profilePassword){
window.localStorage.setItem("userPw", defaultPassword);
$('.appProfile').find('span.showPw').text(defaultPassword);
//document.getElementById('').value = defaultPassword ;
}
else{
//alert(profilePassword +'--')
//document.getElementById('showPw').value = profilePassword ;
$('#showPw').val(profilePassword)
};
page.querySelector('[component="button/updatePassword"]').onclick = function() {
var newPassword = $('#setPw').val()//document.getElementById('setPw').value;
window.localStorage.setItem("userPw", newPassword);
//document.getElementById('showPw').value = newPassword ;
$('.appProfile').find('span.showPw').text(profilePassword);
alert(newPassword)
$(profilePassword).val(newPassword)
navigator.notification.alert(
'PIN changed Successfully', // message
null, // callback
'Phindor', // title
'Ok' // buttonName
);
// window.localStorage.setItem("userPwOK", result.success);
// console.log(result.message);
// location.reload(true);
};
page.querySelector('[component="button/profilePage"]').onclick = function() {
myApp.currentPage.myNavigator.popPage();
};
}
ここでHTMLれる:
<ons-template id="changePassword.html">
<ons-page id="changePassword">
<div class="appProfile">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div style="text-align: center">
<b>Your current password: </b>
<br>
<br>
<span id="showPw">999</span>
<br>
<br>
<br />
<b>Please select your new password:</b></span>
<br>
<br>
<ons-input type='text' id="setPw" name="setPw" placeholder="Type your new password here"></ons-input>
<br />
<br />
<br />
<ons-button component="button/updatePassword" ripple>Update Password</ons-button>
<br />
<br />
<br />
<ons-button component="button/profilePage" ripple>Back</ons-button>
</div>
</div>
</ons-page>
</ons-template>
全体wwwディレクトリはここにある:https://wetransfer.com/downloads/76bc6b9f75a44b7f7054036a7cf478ab20161226102828/3be6ca
私はコルドバ
でアプリケーションを構築しています
この問題を再現するために必要な完全なコードを示してください。 –
はオブジェクトのパスワードの一部を変更しますか? –
私はダウンロードするためにwwwファイルを追加しました。うまくいけば助けてくれるでしょう –