I want to check whether a cells of a certain column of a html table is filled completely. The 5th column of the #mf-table could not be kept unfilled.
I used following function to select the column. It works fine.
$.fn.column = function(i) {
return $('tr td:nth-child('+(i+1)+')', this);
}
I used the following method to pop up a warning if column has empty cells.
if ($('#mf-table').column(5).is(":empty")) {
toastr.error('Fill empty fields');
}
This method does not working. Can any one tell what is wrong here?
edit:
I tried following method. In order to test my code I colored the column 5 and it works fine. Here I have considered a situation where any of the cell is empty in whole table
if ($('#mf-table tr td').is(":empty")) {
$('#mf-table').column(5).css( "background-color", "red" )
}
So in the above method, if at least one cell is empty, the column 5 is colored. I need help to alter this method to check whether at least one cell is empty in column 5.