i'm trying to make a 'password protected' page for the pages that I build for customers, so that they can check the progress of their page, but it won't be available for people who don't have a code.
I've been trying a few hours now but i can't seem to get it working. I can get a popup screen now with a place with the login code, but I can't make it redirect to another page.
Here's my code:
$(document).ready(function() {
$('.accesbutton').click(function() {
$('.login').fadeIn('fast');
$('.opening').fadeTo('fast', 0.2);
});
var $code = $('.logincode').val();
var $check = 'DDT4DHFD';
$('.submit').click(function() {
if ($code === $check) {
window.location = 'homepage.html';
} else {
$('.logincode').animate({
color: 'red'
});
}
});
});
.login {
background-color: #FFFFFF;
position: absolute;
margin: auto;
padding: 0 1em;
left: 35%;
top: 10em;
width: 30%;
height: auto;
z-index: 1000;
display: none;
}
.accesbutton {
background-color: #FF3333;
width: 10em;
height: 3em;
line-height: 3em;
margin: 2em auto;
border-radius: 25px;
text-align: center;
}
.text {
color: #ffffff;
text-align: center;
font-family: "Open Sans";
font-size: 1.2em;
}
<body>
<html>
<div class="accesbutton">
<p class="text">Bekijk website</p>
</div>
<div class="login">
<p class="text" style="color:#000000">Je kunt hier inloggen met een toeganscode.
<br>
<br>Heb je geen toegangscode? Neem dan contact op met The Design Company of je Beheerder.
<br>
</p>
<p class="text" style="color:#000000">
<label for="usermail">Toegangscode:</label>
<input type="text" name="usercode" placeholder="XXXXXXXX" class="logincode" required>
<input type="submit" value="Login" class="submit">
</p>
</div>
</body>
</html>
Some of the text is in dutch, including the button.
The first part opens the pop up screen, and the second part should redirect to the page when the code is correct.
What am I doing wrong?
-Johr Claessens
var $check=$....Inside the click function