【问题标题】:AddClass body tinymce by jqueryjQuery的AddClass body tinymce
【发布时间】:2018-04-07 22:11:40
【问题描述】:
add_action( 'admin_head', 'fb_add_tinymce' );
    function fb_add_tinymce() {
    global $typenow;
if( ! in_array( $typenow, array( 'post', 'page' ) ) )
    return ;
add_filter('mce_external_plugins', 'my_tinymce_plugins');
}
function my_tinymce_plugins() {
$plugins_array = array(
    'columns' => get_template_directory_uri().'/editor_plugin.js'
);
return $plugins_array;
}

文件 editor_plugin.js:

( function() {
       $ = jQuery;
       $('#tinymce').addClass('abs');

 })();

这不起作用:(帮帮我 我想用js添加类而不是php(不是php)

【问题讨论】:

  • 我不确定您的 .js 文件是否正确。但首先,您是否检查了您的页面以确保 js 文件正在加载?

标签: javascript jquery wordpress tinymce


【解决方案1】:

这样就可以了:

editor = tinymce.get('#your_editor_id');
$(editor.getBody()).addClass('abc');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-23
    • 1970-01-01
    • 2011-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-06
    • 2012-02-05
    相关资源
    最近更新 更多