visibility:visible/hidden div

css, html, jquery, visibility

Solution

You can use the `show` and `hide` methods:

$(".imageIcon").click(function() {
    $('.imageShowWrapper').show();
});

$(".imageShowWrapper").click(function() {
    $(this).hide();
});

Problem

What is the best way to show a div when clicked on a button and then hide it with a close button?? My Jquery code is as follows: ``` $(".imageIcon").click(function(){ $('.imageShowWrapper').css("visibility", 'visible'); }); $(".imageShowWrapper").click(function(){ $('.imageShowWrapper').css("visibility", 'hidden'); }); ``` except the problem I'm having is it closes automatically without any clicks. It loads everything ok, displays for about 1/2 sec and then closes. Any ideas?

Original source

Related problems