Axel Posted April 20, 2014 Share Posted April 20, 2014 var colspanstart = $(rowID).find("td[colspan]").attr("class"); The above works but it only lets me manage the first element it finds matching that criteria on the row. If there are multiple colspans on that row, how would I select the second or third one for example? Many thanks. Link to comment Share on other sites More sharing options...
0 mollick2 Posted April 20, 2014 Share Posted April 20, 2014 Your gonna want to use the each function var colspanstart = new Array() $(rowID).find("td[colspan]").each( function() { colspanstart.push( this.attr("class") ) }) Seahorsepip and snaphat (Myles Landwehr) 2 Share Link to comment Share on other sites More sharing options...
0 Axel Posted April 24, 2014 Author Share Posted April 24, 2014 Brilliant! Many thanks. Link to comment Share on other sites More sharing options...
0 spacer Posted April 24, 2014 Share Posted April 24, 2014 I prefer to use "rowID" as a selector constraint. $('td[colspan]', rowID) Then you can use the ":eq()" filter in your selector if you really only want the second or third td. $('td[colspan]:eq(2)', rowId) Link to comment Share on other sites More sharing options...
Question
Axel
The above works but it only lets me manage the first element it finds matching that criteria on the row.
If there are multiple colspans on that row, how would I select the second or third one for example?
Many thanks.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts