javascript - Disable click event on HTML table cell -


how disable click on table cell when cell empty or has value zero. have table in when click on particular cell operations performed. want click event not work when table has cell value 0 or empty cell

$('#tablename').off('click','td').on('click', 'td', function(e) {      var column = e.delegatetarget.thead.rows[0].cells[this.cellindex];     var row = this.parentnode.cells[1];       if ($(row).text().trim() == "")     {         row = this.parentnode.cells[0];      }      var rowvalue = $(row).text();     var columnvalue = $(column).text(); } 

$('td').click(function(){    var v = $(this).html();    if( $.trim(v) != '0' && v != '' ){       // code    } }); 

hope helps you.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -