TogglePopup

by shriek

HTML

<div class="togglePopup">hello
    <div class="popup">pop</div>
</div>
<div class="togglePopup">hello2
    <div class="popup">pop2</div>
</div>
<div class="togglePopup">hello3
    <div class="popup">pop3</div>
</div>

CSS

.popup{
    display:none;
}

JavaScript

(function hideShowToggle(event,wrapper,popup) {
    $(document).on("click", wrapper, function() {
        $(this).children(popup).toggle();
        $(popup+":visible").toggle();
        $(this).children(popup).toggle();
    });
}());