# What does the .end() function do in jQuery?

jQueryWeb DevelopmentFront End Technology

The end() method reverts the most recent destructive operation, changing the set of matched elements to its previous state right before the destructive operation.

## Example

You can try to run the following code to learn how to work with end function in jQuery:

Live Demo

<html>
<title>jQuery end() function</title>

<script>
$(document).ready(function(){$("p").find("span").end().css("border", "2px blue solid");
});
</script>

<style>
p{
margin:10px;
</html>