I've been honing my skills in basic programming using Bootstrap
, HTML
, CSS
, and JavaScript
. Currently, I'm working on a website that begins with a landing page prompting for a password before redirecting to another page.
The issue I'm encountering is that the form and JavaScript validation are not syncing up correctly. I'm unsure of what's causing this problem or where I may be going wrong. Any assistance would be greatly appreciated! Thank you!
<div class="jumbotron">
<form name="PasswordField" action="">
<div class="form-group">
<label for="exampleInputPassword1"><h4>If you're an octopus I am...</h4></label>
<input type="password" class="form-control" id="password" placeholder="Password">
</div>
<button type="submit" onclick="isValid()" class="btn btn-default">Submit</button>
</form>
</div>
<script type="text/javascript">
function isValid(password)
{
var pass ="seahorse";
var password = document.getElementById("password");
if (password.value.toUpperCAse().match(pass))
{
window.location.href = "HappyChristmas.html";
return true;
}
else
{
alert('Nope, try again');
return false;
}
}
</script>