$(":last-of-type")selects elements that are last of their types within their parents i.e. NOT followed by a sibling of the same element name .
$("div:last-of-type")will find last
<div>that is NOT followed by any element of the same type or name
<p>a</p> //last of its type, but not <div> <div>b</div> // <div>, but not last of its type <div>c</div> // <div> & last of its type, no other <div> following itExample 2:
$(".d:last-of-type")will find elements with
class='d'and last of their type within their parents.
<div> <p>a</p> <span class="d">b</span>//class='d' but NOT last element of type <span> within its parent <span>c</span> </div> <div> <span>d</span> // first element of type <span> within its parent but without class='d' <p class="d">e</p> // last element of type <p> within its parent with class='d' <span class="d">f</span> // class='d' and last of its type <span> </div>