title: Replace Span with a variable in JQuery
body: <p>I want to replace the "showPw" span with the "userPw" value - I'm trying to do this using profilePassword, which is set when they choose to change the password.</p>
  
  <p>If the page finds that one hasn't been set before, then it should bring the defaultPassword which is 0000</p>
  
  <p>Currently, it only shows the 999 value, it doesn't update. Although I've tested the "userPw" value and it shows correctly in alerts, that and the defaultPassword, etc... any ideas?</p>
  
  <p>Here is the Javascript:</p>
  
  <pre><code>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();
      };
  }
  </code></pre>
  
  <p>Here is the HTML:</p>
  
  <pre><code>    &lt;ons-template id="changePassword.html"&gt;
              &lt;ons-page id="changePassword"&gt;
                  &lt;div class="appProfile"&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;div style="text-align: center"&gt;
                          &lt;b&gt;Your current password: &lt;/b&gt; 
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;span id="showPw"&gt;999&lt;/span&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;br /&gt;
                          &lt;b&gt;Please select your new password:&lt;/b&gt;&lt;/span&gt;
                      &lt;br&gt;
                      &lt;br&gt;
                      &lt;ons-input type='text' id="setPw" name="setPw" placeholder="Type your new password here"&gt;&lt;/ons-input&gt;
                      &lt;br /&gt;
                      &lt;br /&gt;
                      &lt;br /&gt;
                      &lt;ons-button component="button/updatePassword" ripple&gt;Update Password&lt;/ons-button&gt;
                      &lt;br /&gt;
                      &lt;br /&gt;
                      &lt;br /&gt;
                      &lt;ons-button component="button/profilePage" ripple&gt;Back&lt;/ons-button&gt;
  
                      &lt;/div&gt;
  
  
                  &lt;/div&gt;
              &lt;/ons-page&gt;
      &lt;/ons-template&gt;
  </code></pre>
  
  <p>the whole www directory is here: <a href="https://wetransfer.com/downloads/76bc6b9f75a44b7f7054036a7cf478ab20161226102828/3be6ca" rel="nofollow noreferrer">https://wetransfer.com/downloads/76bc6b9f75a44b7f7054036a7cf478ab20161226102828/3be6ca</a></p>
  
  <p>I'm building an app with Cordova</p>