Jquery .each(): find elements containing input

Posted by Poku on Stack Overflow See other posts from Stack Overflow or by Poku
Published on 2010-05-11T12:14:42Z Indexed on 2010/05/11 12:24 UTC
Read the original article Hit count: 292

Filed under:
|

Hey,

I have a table which have a thead section and a tbody section. Im 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?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript