how to set nicedit uneditable

旧城冷巷雨未停 提交于 2019-12-12 10:49:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!