jquery - how to get prev and child -
jquery - how to get prev and child -
i have this
<ul> <li>-</li> <li>-</li> </ul> <table id="foo"> <thead> <tr> <th>-</th> <th>-</th> </tr> </thead> </table>
and select li
, th
#foo
var controls = $('#foo').find('th').end().prev().find('li').css('background','red');
http://jsfiddle.net/c1kpg3f1/1/
i seek add() , addback()
, nil right.
try
$('#foo').find("th").add($('#foo').prev().find('li')).css('background','red');
demo jquery jquery-selectors
Comments
Post a Comment