HOW TO GET THE TR on which I clicked?

Keywords´╝Ü javascript jquery


I have an HTML table with different rows (TR) and when I click on one row the background color changes (if it blank it becomes blu and if it blue it becomes white). The question is: How can I exclude from this onclick event the TR that have the TD with the class 'EXPANDREDUCE '? Thanks in advance

My code is the following but it doesn t work because in this way it works on each TR i click but I need to check if in the TR that I clicked there is one or more TD with the CLASS EXPANDREDUCE and if yes i don't need to do anything :

function rowHighlight() {

  $("TR").click(function () {

    try {
    } catch(err) {}




By using the property, like this:

$("tr").on("click", function(event) {
  var tr = $(;

Good luck.