Home >>jQuery Tutorial >jQuery :last Selector
jQuery :last selector in jQuery is used to selects the last single element you can select more than one element (one for each parent).
Syntax:$(":last")Here is an Example of jQuery :last Selector:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p:last").css("background-color", "lightgreen");
});
</script>
</head>
<body>
<p>This is a first paragraph.</p>
<p>This is a second paragraph.</p>
<p>This is a Third paragraph.</p>
</body>
This is a first paragraph.
This is a second paragraph.
This is a Third paragraph.