I am trying to save the user and password values on my app to eliminate typing. My user is an input field with a text type and my password is an input field with the password type.
I am running the following javascript on value change of a toggle button that I added to my login screen. My variables are both being logged currently as undefined.
var a = $(this).val();
var name = $('#usernameValue').val();
var pw = $('#passwordValue').val();
console.log(name);
console.log(pw);
if (a == 'on') {
localStorage.setItem("UserID",name);
localStorage.setItem("Password",pw);
} else {
localStorage.setItem("UserID",'');
localStorage.setItem("Password",'');
}
What is the correct syntax to return the on screen values of the my user and password input fields.
var name = Appery('usernameValue').val();
var pw = Appery('passwordValue').val();
var name = Appery('usernameValue').val();
var pw = Appery('passwordValue').val();
That worked. Thanks.
Can anyone tell me what was wrong with my original code that it couldn't find those values?