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 https://www.neowin.net/forum/topic/1210155-jquery-find-with-multiple-results/ 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") ) }) snaphat (Myles Landwehr) and Seahorsepip 2 Share Link to comment https://www.neowin.net/forum/topic/1210155-jquery-find-with-multiple-results/#findComment-596368997 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 https://www.neowin.net/forum/topic/1210155-jquery-find-with-multiple-results/#findComment-596373907 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 https://www.neowin.net/forum/topic/1210155-jquery-find-with-multiple-results/#findComment-596373919 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
https://www.neowin.net/forum/topic/1210155-jquery-find-with-multiple-results/Share on other sites
3 answers to this question
Recommended Posts