开发者

Click event on table row, except td with class="someClass"

开发者 https://www.devze.com 2023-01-01 06:19 出处:网络
I want to do some operations after click on row, except td with class=\'someClass\' $(\'#mainTable tr td:not([class=someClass])\')开发者_StackOverflow社区.unbind().live(\'click\',function ()

I want to do some operations after click on row, except td with class='someClass'

  $('#mainTable tr td:not([class=someClass])')开发者_StackOverflow社区.unbind().live('click',function () 
  {
  //some operation
  });

what is wrong?

note: this td is not last td in table.


Maybe I'm missing something here but can't you just...

$('#mainTable tr td').not('.someClass').click(function(){
  //some operation
});


Have you looked into using hasClass?

If you leave the click event bound then on the td click event check

$(this).hasClass("SomeClass"); 

The article probably explains how to use it better than I could

0

精彩评论

暂无评论...
验证码 换一张
取 消