javascriptjqueryhtmltinymcewysiwyg

make readonly/disable tinymce textarea


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


Solution

  • 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);