Q:

How to change text in jQuery and reset original text after 5 seconds

I want to change a list item with the id & title Save to Saved when the user clicks on that list item. Then, after 5 seconds, I want Saved to revert back to Save. I am not concerned with how it changes, whether it fades out or other.
I have tried unsuccessfully with setTimeout. Is that the correct approach?

A:

You should really show what you have tried so far. That said, the below will work for your needs:

$('#save').click(function() {
  var $this = $(this);
  var originalText = $this.text();
  $this.text('Saved');
  setTimeout(function() {
    $this.text(originalText)
  }, 5000); 

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
  <li id="save">Save</li>
</ul>

