Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to disable tinymce editor
    text
    copied!<p>I want to disable tinymce editor using Javascript. Actually, I have two radio buttons: 1) <code>On</code> &amp; 2) <code>Off</code>.</p> <p>When the user selects the <code>Off</code> radio button, my tinymce editor should be <code>readonly/disabled</code> &amp; when the user selects the <code>On</code> radio button, my tinymce editor should be <code>enabled</code>.</p> <p>How can I achieve that?</p> <p>EDITED:- (As it is not working in IE8)</p> <pre><code>tinyMCE.init({ force_p_newlines : false, force_br_newlines : false, forced_root_block : false, convert_newlines_to_brs: false, // Not to add br elements. remove_linebreaks : true, mode : "textareas", theme : "advanced", plugins : "safari", convert_urls : false, width : "560", height : "15", theme_advanced_buttons1 : "fontselect,fontsizeselect, separator, bold,italic,underline,separator,forecolor,backcolor,justifyleft,justifycenter,justifyright,justifyfull", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", extended_valid_elements : "a[name|href|target|title|onclick],img[class|src| border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]" }); </code></pre> <p>This code is used to disable:</p> <pre><code>function tinymce_state(id, disable){ var state = (disable==true)? 'Off' : 'On' tinymce.get(id).getDoc().designMode = state; tinymce.get(id).controlManager.get('fontselect').setDisabled(disable); tinymce.get(id).controlManager.get('fontsizeselect').setDisabled(disable); tinymce.get(id).controlManager.get('bold').setDisabled(disable); tinymce.get(id).controlManager.get('italic').setDisabled(disable); tinymce.get(id).controlManager.get('underline').setDisabled(disable); tinymce.get(id).controlManager.get('forecolor').setDisabled(disable); tinymce.get(id).controlManager.get('backcolor').setDisabled(disable); tinymce.get(id).controlManager.get('justifyleft').setDisabled(disable); tinymce.get(id).controlManager.get('justifycenter').setDisabled(disable); tinymce.get(id).controlManager.get('justifyright').setDisabled(disable); tinymce.get(id).controlManager.get('justifyfull').setDisabled(disable); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload