Script to Toggle TinyMCE for ALL TextAreas
TinyMCE has it's foibles (as you will surely know if you've found this post) and many people - particularly those with HTML knowledge - like to turn it off. In our CMS this is achieved with a toggle button, and some javascript. I thought I'd share it, because it is SO useful to us:
1. Make sure this javascript appears somewhere:
$(function() {
$("#richTextToggle").toggle(function(){
$("textarea").each(function(){
tinyMCE.execCommand('mceRemoveControl', false, $(this).attr('id'));
})
}, function () {
$("textarea").each(function(){
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
})
});
});
2. Create a toggle link / btn:
Toggle Rich Text
1. Make sure this javascript appears somewhere:
$(function() {
$("#richTextToggle").toggle(function(){
$("textarea").each(function(){
tinyMCE.execCommand('mceRemoveControl', false, $(this).attr('id'));
})
}, function () {
$("textarea").each(function(){
tinyMCE.execCommand('mceAddControl', false, $(this).attr('id'));
})
});
});
2. Create a toggle link / btn:
Toggle Rich Text
Comments