我正在做這樣的事情:如何完全摧毀tinymce?
在網頁上,有一篇文章用DIV編輯按鈕編輯。當用戶點擊Edit按鈕時,通過javascript插入textarea,將DIV的html加載到textarea中,加載並初始化tinymce。當用戶點擊保存按鈕時,通過ajax保存並更新文章,並完全銷燬tinymce。
問題是,我沒能銷燬tinymce。這裏是the doc of the destroy method。
我將TinyMCE的jQuery的版本中,最新的V3.2.2
下面是示例代碼:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="../js/tinymce/jquery.tinymce.js"></script>
<script type="text/javascript">
$(function() {
$('button.load').click(loadTinyMCE);
$('button.destory').click(destoryTinyMCE);
});
function loadTinyMCE() {
$('textarea').tinymce({
script_url : '../js/tinymce/tiny_mce.js'
});
}
function destoryTinyMCE() {
$('textarea').tinymce().destroy();
}
</script>
</head>
<body>
<textarea>abc</textarea>
<button type="button" class="load">Load TinyMCE</button>
<button type="button" class="destory">Destory TinyMCE</button>
</body>
</html>
1.你能告訴你的,你不能完全摧毀TinyMCE的代碼? 2.什麼讓你覺得它隱藏起來? – 2010-04-18 20:38:53
它不只是隱藏。我只是編輯帖子。對不起。 – powerboy 2010-04-18 22:24:50
你的代碼表明你正在銷燬TinyMCE。你爲什麼認爲它沒有被破壞?你如何定義「失敗」:通過你在DOM中看到的東西仍然存在,或者可能是在UI上可視化的東西? – 2010-04-18 22:51:37