実演するには、私のhtmlを見てください:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
See it:
<pre>
print "Say hello"
</pre>
<p><b>==SEP==</b></p>
<pre>
class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded <a href="#voila1">tags</a>.
}
</pre>
</html>
Chrome v26 コンソールで、次を実行します。
var pres_orig=$('pre').clone()
$('pre').replaceWith('<pre>spam</pre>')
それから私の質問:<pre>
私のページが元のコンテンツを表示するように、保存された pres_orig からコンテンツを複製する方法は?
私は動作しない次のことを試しました:
$('pre').replaceWith(pres_orig)