Compare input field with local storage variable javascript
Hi,
I have written some javascript to compare the text of a input component to that of a local storage variable when a button is clicked and either navigate to a page if successful or generate an alert if unsuccessful. The local storage variable is set to "Hospital1" and when I enter "Hospital1" into the input component, I continue to get my alert that the values do not match. I've added my javascript below. Can you please let me know if you see any issues? Thanks!
var password = localStorage.getItem('hospitalId');
var input = Apperyio('input').val();
if(input == password){
Apperyio.navigateTo('ipadscreen1', {});
}
else
{
alert ("The password you entered is incorrect. Please try again");
}