my simple script here
$(".showHide").click(function (e) {
e.stopPropagation();
$(".showHide").children('.showHide').toggle();
});
$(".modal-inside").click(function (e) {
e.stopPropagation();
});
$(document).bind('keydown', function(e) {
if (e.which == 27) {
$(".showHide").children('.showHide').hide();
}
});
It shows only last hided div, but I want it to show only direct child.
You need
$(this)
instead of$(".showHide")
to get the children of event source element.Live Demo
Edit to hide when click out side .modal-inside you can use
mouseup
Live Demo