[英]tinymce editor is not displaying and getcontent returns false
This is the path of tinymce: 这是tinymce的路径:
<script type="text/javascript" src="demo/tinymce/js/tinymce/tinymce.js"></script>
My text area is : 我的文字区域是:
<textarea name="description" id="description" class="texarea" >
this is my TinyMCE init code: 这是我的TinyMCE初始化代码:
<script type="text/javascript">
tinymce.init({
selector: "texarea",theme: "modern",width: 680,height: 300,
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
"table contextmenu directionality emoticons paste textcolor ResponsiveFilemanager"
],
toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
toolbar2: "| ResponsiveFilemanager | link unlink anchor | image media | forecolor backcolor | print preview code ",
image_advtab: true ,
external_filemanager_path:"ResponsiveFilemanager/filemanager/",
filemanager_title:"Responsive Filemanager" ,
});
</script>
The problem is the text area is not showing the editor and 问题是文本区域未显示编辑器,并且
tinyMCE.get('description').getContent()
return error "Uncaught TypeError: Cannot read property 'getContent' of null". 返回错误“未捕获的TypeError:无法读取null的属性'getContent'”。 Please help me to find the error in this code.
请帮助我找到此代码中的错误。 Thanks in advance.
提前致谢。
You have a typo. 你有错字 It's
textarea
, not texarea
. 它是
textarea
,而不是texarea
。 Also, the last comma shouldn't be there: 另外,最后一个逗号也不应该出现在这里:
<script type="text/javascript">
tinymce.init({
selector: "textarea",theme: "modern",width: 680,height: 300,
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars insertdatetime media nonbreaking",
"table contextmenu directionality emoticons paste textcolor ResponsiveFilemanager"
],
toolbar1: "undo redo | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | styleselect",
toolbar2: "| ResponsiveFilemanager | link unlink anchor | image media | forecolor backcolor | print preview code ",
image_advtab: true ,
external_filemanager_path:"ResponsiveFilemanager/filemanager/",
filemanager_title:"Responsive Filemanager"
});
</script>
EDIT: 编辑:
Also, you're missing the closing tag of the textarea
: 另外,您缺少
textarea
的结束标记:
<textarea name="description" id="description" class="texarea" ></textarea>
Now it should work. 现在应该可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.