Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set nicedit uneditable

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

like image 585
Apache Avatar asked Nov 26 '10 03:11

Apache


4 Answers

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.

like image 125
Douglas.Sesar Avatar answered Nov 17 '22 00:11

Douglas.Sesar


finally the solution is

var myNicEditor = new nicEditor(); myNicEditor.addInstance('templateContent'); nicEditors.findEditor("templateContent").disable();

like image 22
Apache Avatar answered Nov 17 '22 01:11

Apache


With the statement nicEditors.findEditor("TextArea").disable(); niceditor is non editable But

nicEditors.findEditor("TextArea").attr("contentEditable","true");

does not make it editable again

like image 1
rohan Avatar answered Nov 17 '22 02:11

rohan


for me only this worked:

document.getElementsByClassName('nicEdit-main')[0].removeAttribute('contentEditable');
like image 1
tibi Avatar answered Nov 17 '22 00:11

tibi