make readonly/disable tinymce textarea make readonly/disable tinymce textarea javascript javascript

make readonly/disable tinymce textarea


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


From version 4.3.x on you can use code below for readonly mode

tinymce.activeEditor.setMode('readonly');

and for design mode:

tinymce.activeEditor.setMode('design'); 


IF you only have one editor, this works:

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

If you have multiple editors, you have to select them by the id of the textarea:

tinyMCE.get('textarea_id').getBody().setAttribute('contenteditable', false);