To select the last child of the parent element, last child selector can be used.
<script language="javascript" type="text/javascript">
$("#div2 p:last-child").css("background", "red");
</script>
Above code snippet will select the last paragraph (p) element that is inside the div element whose id is “div2” and will change the background color as red.
Views: 7534 | Post Order: 16