JSFiddle - React, Tailwind, and code Playground
HTML
<div class="restore">Hello</div>
<div class="restore">World</div>
<div class="restore">Whats</div>
<div class="restore">Going</div>
<div class="restore">Down?</div>
CSS
.restore { font-family: 'courier' }
JavaScript
// Access all elements to restore
var restore = $(".restore");
// Save original HTML, and set new HTML
restore.each(function(i,o){
var that = $(this);
that.data("original", that.html())
.html("Changed " + i);
});
// After 2 seconds, restore original HTML, remove stored data
setTimeout(function(){
restore.each(function(i,o){
var that = $(this);
that.html( that.data("original") )
.removeData( "original" );
});
}, 2000);