Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8617847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:57:55+00:00 2026-06-12T05:57:55+00:00

I am using TinyMCE and I want to set the default font-size to 12.

  • 0

I am using TinyMCE and I want to set the default font-size to 12.

Here, I assigned a variable to the active TinyMCE editor, but it’s not working…

HTML content:

<textarea id="text_message"></textarea>

JavaScript:

$("#text_message").tinymce({        
    // Location of TinyMCE script
    script_url: '/static/app/a/scripts/tinymce/jscripts/tiny_mce/tiny_mce.js'
});

var fontSize = 12;
tinyMCE.activeEditor.formatter.apply('fontSize', 
{
    value: fontSize
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:57:56+00:00Added an answer on June 12, 2026 at 5:57 am

    There’s a couple of different event stages you should wait for:

    1. The page is ready in some state. (tinyMCE.init() can also be used, depending on the situation.)
    2. The editor has been initialized and is ready for you to being working on it.

    The first can be accomplished using either:

    $(document).ready()
    

    Or:

    $(window).load()
    

    Both handle events related to the readiness of the page. $.ready() triggers when the DOM is available, $.load() in the case of window triggers when the page content has been loaded (such as inline img, script, and link sources). .ready() fires slightly before the other, but in many cases either will work.

    Note, below I’ve got jQuery(function($){...}); which is a shortcut to $(document).ready(); and helps manage conflicts with other frameworks that use $ globally.

    At the second stage you need to add an initialization event handler to your editor creation request, such as:

    $.tinymce({ init_instance_callback: function(){ ... } });
    

    In full:

    $tiny.tinymce({
        // ... other stuff here, comma-delineated
        init_instance_callback: function(){
            ac = tinyMCE.activeEditor;
    
            ac.dom.setStyle(ac.getBody(), 'fontSize', fontSize);
        }
        // ... other stuff here, comma-delineated
    });
    

    Here is where you can set the display value for font-size (using the Javascript property of fontSize, since Javascript doesn’t allow - in labels such as font-size). This waits for the editor you’re adding to initialize and say “Hey, I’m here now”. Once you get that notification of the vent firing, you can set the editor body (what ac.getBody() returns) to be font-size: 18px.

    What this means is that the font-size will not be returned once you choose the save the editor content; it’s above it in in the editor “body” (literally, the iframe‘s body element), in most cases (unless you choose the plugins : "fullpage" initialization option). So it’s a “default”, but does not get set explicitly within the content itself.

    If you have Chrome or Firefox with Firebug add-on installed, watch the console on this fiddle:

    http://jsfiddle.net/userdude/9PuUx/1/

    Here is the working code demo and link to a fiddle demo (I use 18px to easily see the change):

    jQuery(function a($){
        var $tiny = $("#text_message"),
            fontSize = '18px',
            ac;
    
        $tiny.tinymce({
            mode : "textareas",
            theme : "advanced",
            theme_advanced_buttons1 : "fontsizeselect,bold,underline,italic",
            init_instance_callback: function(){
                ac = tinyMCE.activeEditor;
    
                ac.dom.setStyle(ac.getBody(), 'fontSize', fontSize);
            }
        });
    });​
    

    http://jsfiddle.net/userdude/9PuUx/

    The tinyMCE documentation and API can be a bit confusing and lacking, and I’m not an expert in using it either, so I know there’s perhaps four or five other ways to interpret what’s going on and how to do this. Your mileage may vary. If you have an issue with the way I did this or it does not seem to do what you want or expect, just leave a comment and let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using TinyMCE editor. I want to clear the content inside the editor
I want to design an editor, but don't want to use TinyMCE's tool bar.
I have a problem as follows: We're using a rich text editor (TinyMCE, but
I am using asp.net, i have added tinyMCE editor to my page. I want
I want to use the site default text editor like TinyMCE or JCE as
The problem is the following: I am using a tinymce editor (not related with
I am using tinymce editor in my asp.net application, I want to implement the
I am using tinyMCE editor in my asp.net application, What I want to if
Im using TinyMCE here is my code :- tinyMCE.init({ // General options mode :
I'm using TinyMCE as the editor for creating an HTML form for people to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.