一直在处理这个错误2天,无法让TinyMCE工作.我正在使用TinyMCE的
jquery版本.下面是我的HTML代码,其中包含一个包含textarea的表单.我使用Google Inspect Element并在控制台选项卡下面出现以下错误:“Uncaught ReferenceError:tinymce未定义”.任何帮助,将不胜感激.
<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>
解决方法
当您使用jquery版本时,您需要将其设置为jquery插件
$(function() { $('textarea.tinymce').tinymce({ ... }); });