Check one element on last row of a table is not empty using Jquery.
- by Cesar Lopez
I have the following function:
var emptyFields = false;
function checkNotEmpty(tblName, columns, className){
emptyFields = false;
$("."+className+"").each(function() {
if($.trim($(this).val()) === "" && $(this).is(":visible")){
emptyFields = true;
return false; // break out of the each-loop
}
});
if (emptyFields) {
alert("Please fill in current row before adding a new one.");
} else {
AddRow_OnButtonClick(tblName,columns);
}
}
Its checking that all elements in the table are not empty before adding a new row, and I only need to check that the last row of the table has at least an element which its not empty and not the whole table.
Any help would be apreciated.
Thanks