我正在做这样的事情:如何完全摧毁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