我有一个带有表格的 DIV。当用户提交表单并成功提交时,我将表单替换为简单的“现在一切正常”消息:
$("#some_div").html("Yeah all good mate!");
有没有一种好方法可以根据它附带的 HTML 将 div “重置”为“原始状态”?我只能想到实际上做这样的事情:
//before I change the DIV
var originalState = $("#some_div").html();
//manipulate the DIV
//...
//push the state back
$("#some_div").html(originalState);
它看起来不太优雅——我想有一个更好的解决方案,不是吗?