TinyMCE not defined by jQuery

Work on this error for 2 days and cannot make TinyMCE work. I am using the jQuery version of TinyMCE. Below is the HTML code with the form containing the text box. I use the Google Inspect Element and under the console tab I get the following error: "Uncaught ReferenceError: tinymce not defined". Any help would be appreciated.

<form id="add_update_form" action="" method="POST" title="Add Blog"> <p class="feedback"></p> <!-- <label>Created:</label> <input type="text" name="created"> --> <label>Title:</label> <input type="text" name="title" class="input-block-level"> <label>Content:</label> <textarea width="100%" rows="10" cols="10" name="content" class="input-block-level"></textarea> <div class="clear"></div> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> <script src="<?php echo base_url();?>js/portal/tinymce/jquery.tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste moxiemanager" ], toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" }); </script> 
+7
source share
3 answers

How do you use the jquery version, you need to configure it as a jquery plugin

 $(function() { $('textarea.tinymce').tinymce({ ... }); }); 

http://www.tinymce.com/tryit/3_x/jquery_plugin.php

+5
source

I looked at this page: http://www.tinymce.com/tryit/3_x/jquery_plugin.php and clicked on the “View Source” tab and noticed something.

If you use TinyMCE as a jQuery plugin, an additional script_url parameter is required , so your code should look like this:

 $('textarea.tinymce').tinymce({ script_url: 'js/portal/tinymce/tinymce.min.js', ... 

Another solution is to use a version other than jQuery:

 <script src="<?php echo base_url();?>js/portal/tinymce/tinymce.min.js"></script> 

and then use the old method to run TinyMCE (as in your source code):

 tinymce.init({ selector: "textarea", ... 
+4
source

It seems that the TinyMCE js file is not loaded. Instead:

 <script src="<?php echo base_url();?>js/portal/tinymce/jquery.tinymce.min.js"></script> 

Try the following:

 <script src="//cdn.jsdelivr.net/tinymce/4.0b2/jquery/jquery.tinymce.min.js" type="text/javascript"></script> 
+2
source

All Articles