Need JQuery to select the table only if its 1st row has more than 1 column
I need to select and act on a table element using JQuery, but only if it contains at least one row with multiple columns. The following selector works, but only part of it gets me:
$('#my_table_is:has(tbody tr)').doSomething();
Variations I've tried without success:
$('#my_table_id:has(tbody > tr > td:eq(1))').doSomething();
$('#my_table_id:has(tbody tr:nth-child(1))').doSomething();
$('#my_table_id:has(td:eq(1))').doSomething();
What combination of selector and filter will do the job?
By the way, the reason I need this is because a tablesorter with a multi-column sorter seems to blow up when only 1 column is outputted in the table.
0
source to share
3 answers
Wouldn't it be easier to actually fix the tablesorter instead of hacking it? (I assume you mean http://tablesorter.com/ ).
0
source to share