Reputation: 299
I need to select all children of the last th table element.
I already tried something like this:
th:last-children
Thank you very much in advance.
Upvotes: 0
Views: 65
Reputation: 531
Try this one,
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery( "table th:last-child" ).last().css( "color", "red" );
alert(jQuery( "table th:last-child" ).last().html());
jQuery("th:last-child").css('background','yellow');
})
</script>
Upvotes: 0
Reputation: 82231
th:last-children
will select th which are last child in their container. you need to use th:last
to target last th element along with .children()
to get its immediate child elements:
$('th:last').children();
or
$('th:last > *');
Upvotes: 0