Reputation: 7443
I need to be capable to restore the HTML code inside a div as it was at page ready. I need this because I want to make some changes to the HTML code after page ready and then revert it to the way it was at page ready when I need it..
I was thinking to use clone, but how do I just copy the content of the div without paste it? I need to copy the content of the div at page ready and then paste it/replace the div with the original when I need..
I am rather new to jquery, I tried several things without luck, I can't find out what I need. Thank you for any suggestion!
Upvotes: 7
Views: 4485
Reputation: 27022
You can copy it into a variable for later.
var originalContent;
$(document).ready(function() {
originalContent = $('#theDiv').clone();
});
Upvotes: 8