本文介绍了需要一些TinyMCE jQuery的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的网站上使用TinyMCE获取textarea格式的文件...我对于整合这种东西并且可以使用一些帮助有点新。



我正在使用他们的jQuery插件3.4.x,在找到。



我似乎对我的textareas没有任何影响!他们仍然看起来像集成此代码之前的常规textareas。我遵循。



以下是我在标题中使用的脚本( script_url 是正确的):

 < script src =tiny_mce / tiny_mce.js>< / script> 
< script type =text / javascriptsrc =tiny_mce / jquery.tinymce.js>< / script>
< script type =text / javascript>
$(document).ready(function(){
$('textarea.tinymce')。tinymce({
theme:simple
});
});
< / script>

和我的textarea:

 < textarea name =textclass =tinymce>< / textarea> 

预先致谢。

解决方案

由于您使用jQuery,请确保您正在实现jQuery的 $(document).ready()函数:

 < script type =text / javascript> 
$(document).ready(function(){
$('textarea.tinymce')。tinymce({
script_url:'tiny_mce / tiny_mce.js',
theme :简单
});
});
< / script>



编辑#1



尝试加载TinyMCE直接保证加载文件没有问题:

 < script src =tiny_mce / tiny_mce.js >< /脚本> 

请确保这已加载BEFORE $(document).ready()但加载jQuery后。然后,省略 $。tinymce() script_url 参数。

编辑#2



jQuery或页面上的其他脚本也可能存在错误。如果在Safari或Chrome中,右键单击并选择 Inspect Element 以检出JS控制台是否有错误。



编辑#3



仔细检查您是否错误输入了 tiny_mce 脚本的URL,并且它正在加载在浏览器中正确(清除缓存!)。另外,如果您同时使用另一个Javascript框架,请确保您运行 jQuery.noConflict()以查看问题是否存在。 p>

编辑#4!我认为我发现了这个问题!



运行博客的人明显地遇到了问题。他的解决方案是在加载jQuery之前完全加载并初始化 tiny_mce.js 。这是,所以你可以看到他是如何做到的。


I'm trying to get some textarea formatting going on my site using TinyMCE... I'm a little new to integrating this kind of thing and could use some help.

I'm using their jQuery plugin 3.4.x found here.

I can't seem to get any kind of effect on my textareas! They still look like the regular textareas from before integrating this code. I'm following this tutorial.

Here is the script I use which is in my header (the script_url is correct):

<script src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('textarea.tinymce').tinymce({
       theme : "simple"
    });
  });
</script>

And my textarea:

<textarea name="text" class="tinymce"></textarea>

Thanks in advance.

解决方案

Since you are using jQuery, make sure you're implementing jQuery's $(document).ready() function:

<script type="text/javascript">
     $(document).ready(function() {
        $('textarea.tinymce').tinymce({
           script_url : 'tiny_mce/tiny_mce.js',
           theme : "simple"
        });
      });
</script>

Edit #1

Try loading TinyMCE directly to be assured that there are no issues with loading the file:

<script src="tiny_mce/tiny_mce.js"></script>

Make sure this is loaded BEFORE $(document).ready() but after loading jQuery. Then, omit the script_url parameter for $.tinymce().

Edit #2

There is also a possibility that there is an error with jQuery, or another script on the page. If in Safari or Chrome, right click and select Inspect Element to check out the JS console for errors.

Edit #3

Double-check that you have not mistyped the URL of the tiny_mce script, and that it is loading correctly (clear your cache!) in the browser. Also, if you are using another Javascript framework simultaneously, make sure you run jQuery.noConflict() to see if that is the issue.

Edit #4! I think I found the issue!

Someone who runs a blog evidently had the exact issue as you did. His solution was to completely load and initialize tiny_mce.js before loading jQuery. Here's a link to the post, so you can see how he did it.

这篇关于需要一些TinyMCE jQuery的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 21:31