Select Last Matching Element $(":last")

$(":last")

e.g. $("div:last")

$(":last") selects last matching element, only one element .

Example 1: $("div:last") will find last matching <div> element.
<div>a</div>
<div>b</div>
<div>c</div>
Example 2: $("span:last") will find last matching <span> element.
<div>
  <span>a</span>
  <span>b</span>
  <span>c</span>
</div>
<div>
  <span>d</span>
  <span>e</span>
  <p>f</p>
</div>
jQuery selector filter $(":last")