JQuery fadeIn, fadeOut div
- by user2908998
I have a button ("login_button"). Every time I click the button I want a DIV ("login_cont") to appear. And after, if I click anywhere else on the page I want this DIV disappear again.
This is my code
$(document).ready(function(){
$('#login_button').click(function(e){
$('#login_cont').fadeIn();
});
$(document).click(function(e){
$('#login_cont').fadeOut();
});
});
This looks good to me (I'm new at this).
But. Every time I click on the button, the div appears but then also disappears in less than a second... why and how can I fix it?