【问题标题】:TypeError: tinymce.get(...) is null - Does not seem to be finding ID properlyTypeError: tinymce.get(...) is null - 似乎没有正确找到 ID
【发布时间】:2014-04-25 20:27:27
【问题描述】:

我在 Wordpress 中使用 tinymce 来满足一些自定义需求。它工作正常,但现在似乎抛出了一个我以前没有的错误。

来自 Firebug

TypeError: tinymce.get(...) 为 null

geqqo_new: tinymce.get('geqqo-editor-new').getContent()

但是事情看起来完全合理 - 他们以前工作过 - 所以请仔细检查我:

JS

tinymce.get('geqqo-editor-new').getContent() 

生成的 HTML

<form action="" method="post" target="_blank">
    <div id="wp-geqqo-editor-new-wrap" class="wp-core-ui wp-editor-wrap html-active">
        <link rel='stylesheet' id='editor-buttons-css'  href='http://localhost/hawaii/somelocal/wp-includes/css/editor.min.css?ver=3.9' type='text/css' media='all' />
        <div id="wp-geqqo-editor-new-editor-tools" class="wp-editor-tools hide-if-no-js">
            <div id="wp-geqqo-editor-new-media-buttons" class="wp-media-buttons"><a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="geqqo-editor-new" title="Add Media"><span class="wp-media-buttons-icon"></span> Add Media</a></div>
            <div class="wp-editor-tabs"><a id="geqqo-editor-new-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">Text</a>
                <a id="geqqo-editor-new-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">Visual</a>
            </div>
        </div>
        <div id="wp-geqqo-editor-new-editor-container" class="wp-editor-container"><textarea class="wp-editor-area" rows="20" autocomplete="off" cols="40" name="content" id="geqqo-editor-new"></textarea></div>
    </div>
</form>

综合考虑,为什么会出现上述错误?

另外,这是使用 Wordpress 的 tinymce 功能,所以从这个最新版本开始可能会抛出一个曲线球?

【问题讨论】:

    标签: javascript jquery wordpress tinymce


    【解决方案1】:

    逐步尝试这些方法,看看它们是否能解决问题:

    1. 将现有主题替换为 2014

    2. 禁用所有插件

    【讨论】:

      猜你喜欢
      • 2012-11-10
      • 2010-09-08
      • 2016-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-06
      • 2021-04-02
      • 1970-01-01
      相关资源
      最近更新 更多