The .end() function in JQuery is used to finish the most recent filtering operation in the chain.
The .end()
function in JQuery is used to finish the most recent filtering operation in the chain.
Example
<div class="parent">
<div></div>
</div>
$(".parent")
.find("div")
.text("child")
.end()
.css("color", "red")
Result
<div class="parent" style="color:red">
<div>child</div>
</div>