i'm using nicedit js which is is a WYSIWYG editor in my textarea to view html doc, but it still editable, how to set this nicedit to readonly mode, i try to search from its doc but unable to find it, do any one have experience using nicedit,
thanks in advance
i'm using nicedit js which is is a WYSIWYG editor in my textarea to view html doc, but it still editable, how to set this nicedit to readonly mode, i try to search from its doc but unable to find it, do any one have experience using nicedit,
thanks in advance
Share Improve this question edited Nov 26, 2010 at 4:17 Apache asked Nov 26, 2010 at 3:58 ApacheApache 1,8069 gold badges51 silver badges72 bronze badges7 Answers
Reset to default 7Here is a helpful jQuery solution that I use with nicEdit:
jQuery('.nicEdit-main').attr('contenteditable','false');
jQuery('.nicEdit-panel').hide();
You can simply change it back to 'true' to make it editable again.
Note: I would consider toggling the div background-color along with this solution.
finally the solution is
var myNicEditor = new nicEditor(); myNicEditor.addInstance('templateContent'); nicEditors.findEditor("templateContent").disable();
With the statement
nicEditors.findEditor("TextArea").disable(); niceditor
is non editable
But
nicEditors.findEditor("TextArea").attr("contentEditable","true");
does not make it editable again
for me only this worked:
document.getElementsByClassName('nicEdit-main')[0].removeAttribute('contentEditable');
I'm going to guess it is a WYSIWYG editor.
Try this...
document.getElementById('nicedit').removeAttribute('contentEditable');
function edit(){
a = new nicEditor({fullPanel : true}).panelInstance('area5',{hasPanel : true}); }
function no_edit(){
a.removeInstance('area5');
}
nicEditors.findEditor("TextArea").disable();
above statement will disable the TextArea.
For enabling the TextArea, update the nicEdit.js (see below what to update)
search for disable: function () { this.elm.setAttribute("contentEditable", "false"); }
next to this code add the below code
, enable: function () { this.elm.setAttribute("contentEditable", "true"); }
and in your JavaScript call nicEditors.findEditor("TextArea").enable();