JQuery .click - exclude specific elements inside div

jquery

Solution

   $("div").click(function(e) {
        if($(e.target).is('p')){
            e.preventDefault();
            return;
        }
        alert("woohoo!");
    }); 

check the target of the click. this way you dont need to bind another event.

Problem

I want .click to do nothing IF the user clicks `<p>text</p>` inside the div, for everything else I want the div .click to work. HTML: ``` <div> <span>yes</span> <p>text</p> </div> ``` Jquery: ``` <script> $(document).ready(function() { $("div").click(function() { alert("woohoo!"); }); }); </script> ```

Original source