How can I “reset” to its original state after it has been modified by JavaScript?
I would clone the element, instead of saving the content. Then use replaceWith to restore it: var divClone = $(“#some_div”).clone(); // Do this on $(document).ready(function() { … }) $(“#some_div”).html(“Yeah all good mate!”); // Change the content temporarily // Use this command if you want to keep divClone as a copy of “#some_div” $(“#some_div”).replaceWith(divClone.clone()); // Restore … Read more