I have a table which has a thead section and a tbody section. I’m using jQuery each to find and count all THs in a table. This works fine. But at the same time I want to check if the TDs of the THs in the tbody is containing any input elements.
Here is what I have so far:
jQuery('#' + _target).each(function () {
var $table = jQuery(this);
var i = 0;
jQuery('th', $table).each(function (column) {
if (jQuery(this).find("input")) {
dataTypes[i] = { "sSortDataType": "input" }
}
else {
dataTypes[i] = { "sSortDataType": "html" }
}
i++;
});
});
I hope this is enough information for you to help me out?
Edit: if you are running this on a single table (in which case the
eachcall in the original example does not make much sense), it gets simpler: