This is the path of 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:
<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". Please help me to find the error in this code. Thanks in advance.
You have a typo. It's textarea
, not 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 name="description" id="description" class="texarea" ></textarea>
Now it should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.