I have a div
<div id="fade_bg">
<div id="login_div">
<form action="../classes/login/Authenticator.php" method="post">
<p>username: <input type="text" name="username" /></p>
<p>password: <input type="password" name="password" /></p>
<p><input type="submit" name="login" /></p>
</form>
<p><a id="cancel" href="#">cancel</a>
</div>
</div>
That I only want to show when
<a id="login" href="">Admin login</a>
is clicked. I used
$(function() {
$('a#login').click(function() {
$('#fade_bg').show();
$('#login').hide();
});
$('a#cancel').click(function() {
$('#fade_bg').hide();
$('#login').show();
});
});
However, when I click the link, the div I want to appear only appears for a split second, then returns to normal as if I clicked the cancel button. Why is this happening?
Edit: No errors on the JS debugger console.