[Django]-Place Click event on a table row but exclude one the columns

9👍

you can use event.target object and class,
e.g.)
if a column has “a specific class(or attribute)”, you can remove the event

$(document).ready(
	function(){
        $("tr").click(function(event){
            console.log($(event.target).hasClass("except"));
        });
    }
);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
  <tr>
      <td class="except">except</td>
      <td>data</td>
  </tr>
</table>
👤Ray

Leave a comment