问题
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
回答1:
Here 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.
回答2:
finally the solution is
var myNicEditor = new nicEditor(); myNicEditor.addInstance('templateContent'); nicEditors.findEditor("templateContent").disable();
回答3:
With the statement
nicEditors.findEditor("TextArea").disable(); niceditor
is non editable
But
nicEditors.findEditor("TextArea").attr("contentEditable","true");
does not make it editable again
回答4:
for me only this worked:
document.getElementsByClassName('nicEdit-main')[0].removeAttribute('contentEditable');
回答5:
I'm going to guess it is a WYSIWYG editor.
Try this...
document.getElementById('nicedit').removeAttribute('contentEditable');
回答6:
function edit(){
a = new nicEditor({fullPanel : true}).panelInstance('area5',{hasPanel : true}); }
function no_edit(){
a.removeInstance('area5');
}
来源:https://stackoverflow.com/questions/4282446/how-to-set-nicedit-uneditable