tags:

views:

39

answers:

2

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

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

what is wrong?

note: this td is not last td in table.

+1  A: 

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

Luke Duddridge
This was a quite quick and dirty fix. You should rather filter out what elements the click handler is attached to -- not add it to every td and then check with hasClass. You add extra overhead of checking with the hasClass function on every click and, more importantly, you have to remember to check this in the future should you need to change the event handler function.
Simen Echholt
+1  A: 

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

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