javascript - how to set certain column unclickable -
i have 20 columns in table , managed rows in table clickable. possible set first column until fifteenth not clickable. below code.
$('#cdctracking-list tr td:not(:nth-child(1))').click( function () { //....rest of code });
firstly, when dealing table want click event on each cell, it's better use delegated event. because there 1 event handler (which on table) instead of 1 handler every td
element.
secondly, achieve need can inspect index()
of clicked cell determine column. try this:
$('#cdctracking-list').on('click', 'td', function () { if ($(this).index() > 15) { // something... } });
Comments
Post a Comment