Finding table rows not containing a specified object
Hi.
I have some code that iterates through <tr> elements containing text input controls in the <td> elements therein. Iterating through the elements, if there are no text inputs that are enabled, then we're hiding that <tr>.
Here's what the code roughly looks like, and it works fine:
$("tr").has('input:disabled,select:disabled,textarea:disabled').each(function(i) {
$(this).find('input[type=text],textarea,select').each(function(j, ele) {
if (ele.disabled != true) {
enabled = true;
return false;
} else {
if (!ele.value.length == 0) {
enabled = true;
return false;
};
}
});
//If every input control in the row is disabled, then hide the row...
if (enabled == false) {
$(this).hide();
}
else {
$(this).show();
}
});
However, my <tr> may contain non-input elements that I do want to show, even if the text inputs are disabled. I'm trying to figure out how I can use the NOT selector to bypass the <tr> elements whose <td>s contain anything other than an input or label. For instance, I don't want to hide a row if it contains an imagebutton or a hyperlink.
Please advise, and thank you.
-BF