I have a DIV element that appears when a certain action is performed.  For the sake of simplicity, I wrote a very simple routine that mimics the issue I'm running into.  The problem I am facing, however, is that when you click inside the DIV element (and outside the textarea), it will hide the DIV anyway.
Here is the code below:
<body>
outside div
<br><br>
<a href="#" id="wrap_on">make inside appear</a>
<br><br>
<div id='wrap' style='background:red;display:none;padding:10px;width:155px'>
    <textarea id='inside'>inside div</textarea>
    <div id='inside2'>also inside div -- click me</div>
</div>
</body>
<script>
$(document).ready(function() {
    $('#wrap_on').click(function() {
        $('#wrap').show();
        $('#inside').select().focus();    
    });
    $('#inside2').click(function() {
        alert('test');
    });
    // #inside2 does not work but #wrap does hide
    $('#wrap').focusout(function() {
        $('#wrap').hide();
    });
});
</script>
Or you can tinker with it here: http://jsfiddle.net/hQjCc/
Basically, I want to be able to click on the text "also inside div -- click me" and have the alert popup.  However, the .focusout function is preventing it from working.  Also, I want to hide the #wrap DIV if you click outside of it.
 
     
     
    