I am having issue trying to get a checkbox on a datatables.js row in one of two situations.
With the code below chkCtrl.name is undefined in the handler function.
$("table#tblAssays tbody tr").each(function (index) {
if ($.trim($(this).find('td:eq(9)').text()) == todayDOW)
{
var chkCtrl = $(this).find("td input:checkbox");
HandleCheckedChanged(chkCtrl);
}
But if I handle the click event as below this.name returns a value
$("#tblAssays").on("click", "tbody td input:checkbox", function () {
HandleCheckedChanged(this);
Could someone point out what I am doing wrong?
Thanks.
$(this).find("td input:checkbox")returns a jQuery object, which has no name property, whereasthiswithin the click handler function refers to a DOM object, which does have a name property.Try
HandleCheckedChanged(chkCtrl[0]);instead.