JQuery fadeIn, fadeOut div

Posted by user2908998 on Stack Overflow See other posts from Stack Overflow or by user2908998
Published on 2013-10-22T21:49:44Z Indexed on 2013/10/22 21:53 UTC
Read the original article Hit count: 97

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html