jQuery :last-child Selector

By: Bipin C Mathew 9 months ago

The :last-child selector lets you select every element that is the last child of its parent, while the:last selector selects only the last one from the element set.

Syntax   $(":last-child")


<!doctype html>
	<html lang="en">
	  <meta charset="utf-8">
	  <title>first-child demo</title>
	  span.solast {
	    text-decoration: line-through;
	  <script src="https://code.jquery.com/jquery-3.4.1.js"></script>
	$( "div span:last-child" )
	  .css({ color:"green", fontSize:"80%" })
	  .hover(function() {
	    $( this ).addClass( "solast" );
	  }, function() {
	    $( this ).removeClass( "solast" );


Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.