我使用nicedit js這是一個所見即所得的編輯器在我的textarea查看html文檔,但它仍然可編輯,如何將此nicedit設置爲只讀模式,我嘗試從它的文檔搜索但嘗試無法找到它,做任何一個使用nicedit有經驗,如何設置nicedit不可編輯
在此先感謝
我使用nicedit js這是一個所見即所得的編輯器在我的textarea查看html文檔,但它仍然可編輯,如何將此nicedit設置爲只讀模式,我嘗試從它的文檔搜索但嘗試無法找到它,做任何一個使用nicedit有經驗,如何設置nicedit不可編輯
在此先感謝
我要去猜測它是一個所見即所得的編輯器。
嘗試......
document.getElementById('nicedit').removeAttribute('contentEditable');
最後的解決方案是
VAR myNicEditor =新nicEditor(); myNicEditor.addInstance('templateContent'); nicEditors.findEditor(「templateContent」)。disable();
這裏是一個有用的jQuery的解決方案,我用nicEdit使用:
jQuery('.nicEdit-main').attr('contenteditable','false');
jQuery('.nicEdit-panel').hide();
你可以簡單地改回爲「真」,使其重新編輯。
注意:我會考慮切換div背景顏色以及此解決方案。
的發言 nicEditors.findEditor("TextArea").disable(); niceditor
是不可編輯 但
nicEditors.findEditor("TextArea").attr("contentEditable","true");
不使其可編輯再次
功能編輯(){
A =新nicEditor({fullPanel:真正} ).panelInstance('area5',{hasPanel:true}); }
功能no_edit(){
a.removeInstance( '區域5');
}
我只有這個工作:
document.getElementsByClassName('nicEdit-main')[0].removeAttribute('contentEditable');
我不能做到這一點。請指導我。我有名爲'area3'的textarea。我把它轉換成niceedit。但即使在我用'area3'替換上面的代碼中的'templateContent'之後,我也無法讓它只讀。請指導我。 – Manoj 2011-03-04 04:54:00
hv u在bkLib.onDomLoaded(function(){}中聲明上面的代碼 – Apache 2011-03-04 07:46:53
謝謝,我明白了 – Manoj 2011-03-08 06:46:50