AddClass body tinymce by jquery

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;
}

File editor_plugin.js:

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

 })();

This is not working :( Help me I want to use js to add classes instead of php (not php)

Upvotes: 1

Views: 294

Answers (1)

Thariama
Thariama

Reputation: 50840

This will do the trick:

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

Upvotes: 1

Related Questions