JQuery invert table selection

Posted by Lars Tackmann on Stack Overflow See other posts from Stack Overflow or by Lars Tackmann
Published on 2010-06-15T04:10:11Z Indexed on 2010/06/15 4:12 UTC
Read the original article Hit count: 277

Filed under:
|

I have page part like this

<div id="inbox">
   <h1>Headline</h1>
   <p>First paragraph</p>
   <table>
    <tbody>
      <tr>
        <td>table stuff</td>
      </tr>
    </tbody>
   </table>

   <p>Second paragraph</p>
</div>

I want to assign a handler to everything within the #inbox div that is not a part (a child) of the table. I tried to do something like

$('#inbox:not(:has(table))').click(function(){
  alert('hello inbox');
});

But that does not work, so how do I invert the selection of the table inside the #inbox ?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors