I\'d like to check for empty TDs (classes a-h only) and if all are empty, then I\'d like to hide the parent TR. The issues I\'m running into are, my empty TDs contain \" \"
"If Empty" is not clear, since in your example, they are filled with "nbsp". This is the reason why I made a function called isEmpty() so you can define your custom rules in there. Since you didn't want requirementRight, I put td:not(.requirementRight). This is not the correct way to do it.
The correct way to do it, would be to put a second class on a-h, such as
Requirement
NOT EMPTY
So we can call tr.find(tr.checkempty)..
Anyway, here's the code!
$("tr").each(function() {
var trIsEmpty = true;
var tr = $(this);
tr.find("td:not(.requirementRight)").each(function() {
td = $(this);
if (isEmpty(td) === false) {
trIsEmpty = false;
}
});
if (trIsEmpty == true) {
tr.hide();
}
});
function isEmpty(td) {
if (td.text == '' || td.text() == ' ' || td.html() == ' ' || td.is(":not(:visible)")) {
return true;
}
return false;
}
Working Example: http://jsfiddle.net/FeQ7h/7/