make readonly/disable tinymce textarea

Ahmed-Anas picture Ahmed-Anas · Dec 14, 2012 · Viewed 66.1k times · Source

I need to disable or make readonly a tinymce textarea at runtime.

Answer

Thariama picture Thariama · Dec 14, 2012

Use the configuration parameter readonly

tinyMCE.init({
        ...
        theme : "advanced",
        readonly : 1
});

Here is a link to a demo.

Update: What you can do to prevent users from editing content in your editor is to set the contenteditable attribute of the editors iframe body to false:

tinymce.activeEditor.getBody().setAttribute('contenteditable', false);