I am new to JQuery and datatables. I have a datatable with three columns in a row. First column is a checkbox and other two columns are text. I want to check whether the first column(checkbox) is checked or not on some event. I am able to get the other fields but i don't know how to check if the checkbox is checked. I have the row id and i am using the below code to get the row and the other columns
function uncheckRow(trId) {<br>
var table = $(‘#example’).DataTable();
var row = table.row("#"+trId);
var rowData = row.data();
var name = rowData[1];
var age = rowData[2];
// need to check if the check box in the 1st column(rowData[0]) is checked or not, If it is checked, i have to uncheck
…
}
I also tried the below approach, it is working fine. But when i move to next page using pagination, this is not working.
var td = $("#"+trId).find("td");
var chkBox = td.eq(0).find('input');
if(chkBox.is(':checked')){
chkBox.prop('checked', false);
}
Please provide the solution. Thanks.