I was trying to add content to the TinyMCE textarea from MySQL. I used setContent(content)
, but the textarea didn't get filled with content on page refresh, and I got this error message below:
Uncaught TypeError: Cannot read property 'setContent' of null
<script src="__PUBLIC__/tinymce/tinymce.min.js"></script>
<script> tinymce.init({selector:'textarea',plugins:'code',content_css:"__PUBLIC__/custom_content.css"});
tinymce.get('textarea').setContent(content....);
</script>
<script src="__PUBLIC__/jquery-1.11.2.min.js"></script>
<textarea class="form-control" id="textarea" name="content" placeholder="content..." rows="30"></textarea>
What am I doing wrong?