Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude Select Click via Jquery

Tags:

jquery

Im trying to trigger an action when I click anywhere on a tr with a class of parent. Excluding when I click on one of the dropdown boxes.

$('tr.parent')
    .css("cursor", "pointer")
    .click(function (e) {
        if($(e.target).not('select')){
            // do something
    }

Im trying the following but this is not working.

http://jsfiddle.net/0Lh5ozyb/60/

like image 650
felix001 Avatar asked May 27 '15 12:05

felix001


1 Answers

Try this :

$('tr.parent')
    .css("cursor", "pointer")
    .click(function (e) {
        if($(e.target).is("select"))
        {
          //... it was a select
        }
      else
       {
         //... it was not a select
       }
   }
like image 102
Royi Namir Avatar answered Oct 29 '22 15:10

Royi Namir