I'm trying to select all elements in the document except for the #private_chat_menu element  and attach a mouseup trigger function to them. However, it runs the function regardless of whether I click a select box inside the #private_chat_menu element or not. Here is the code:
<script>
$("*:not(#private_chat_menu > *)", "body").mouseup(function(e)
{
    var chat_user_container = $('#private_chat_menu');
    var chat_container = $('#chat-wrapper');
    if (chat_container.css("visibility") == 'visible' && chat_user_container.is(':visible'))
    {
        chat_user_container.hide();
    }
});
</script>
<div id="chat-wrapper">
   <div id="private_chat_menu">
      <select id="chat_user_select" name="chat_user_select">
         <option value="">Select Assigned User</option>
         <option value="1">...</option>
         <option value="2">...</option>
      </select>
   </div>
</div>
JSFiddle: http://jsfiddle.net/q0ky2f56/
 
     
    