Determining if the element is the last child of its parent

Solution 1:

Use :last-child selector together with .is()

$('#c').is(':last-child')

Solution 2:

You can use .is() with :last-child like this:

$('#b').is(":last-child"); //false
$('#c').is(":last-child"); //true

You can test it here. Another alternative is to check .next().length, if it's 0 it's the last element.

Solution 3:

if($('#b').is(":last-child")){

}