John Magnolia John Magnolia - 1 year ago 120
Javascript Question

Tinymce auto set readonly if the textarea has readonly

How would I set tinymce to automatically set the editor as readonly if the

textarea
already has the
attr("readonly")

Answer Source

A more general solution might be

tinyMCE.init({
    ...
    setup: function(ed) {
        if($('#'+ed.id).attr('readonly'))
            ed.settings.readonly = true;
    }
});

This will work for all textareas without you having to specify any ids. In addition it will actually set the editor to readonly mode, and not only prevent editing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download