Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change tinyMce editor's height dynamically

I am using tinymce editor in my page. What I want to do is to change the height of the editor dynamically. I have created a function:

function setComposeTextareaHeight()
{
    $("#compose").height(200);
}

but that is not working. My textarea is

<textarea id="compose" cols="80" name="composeMailContent" style="width: 100%; height: 100%">

I have tried all sorts of methods for changing the height but could not come to a resolution. Is there any thing that i am missing?

like image 706
Ansh Avatar asked Mar 06 '12 16:03

Ansh


1 Answers

You can resize tinymce with the resizeTo theme method:

   editorinstance.theme.resizeTo (width, height);

The width and height set the new size of the editing area - I have not found a way to deduce the extra size of the editor instance, so you might want to do something like this:

   editorinstance.theme.resizeTo (new_width - 2, new_height - 32);
like image 194
Remember Monica Avatar answered Sep 16 '22 12:09

Remember Monica