簡體   English   中英

無法在Web瀏覽器COntrol中設置NiceEditor內容

[英]Unable to set NiceEditor content in Web Browser COntrol

我在Web瀏覽器控件上使用NiceEdtor。 在jQuery ready()函數我試圖設置它的內容,結果我得到以下錯誤:

Object doesn't support property or method 'setContent'

以下是我給出的代碼:

$(function () {
    var nicE = new nicEditors.findEditor('__edit');
    nicE.setContent("<b>Hi</b>");
}); 

文本區域定義如下:

<textarea name="question" rows="15" cols="130" id="__edit"></textarea>

您需要使用nicEditors.allTextAreas();將textarea實例化為niceEditor控件nicEditors.allTextAreas(); 或者new nicEditor().panelInstance('__edit');

$(function () {

     //nicEditors.allTextAreas();  // Set globally for all textareas.
   new nicEditor().panelInstance('__edit'); // redister textarea to be a niceeditor

   ///... some code

    var nicE = new nicEditors.findEditor('__edit');
    nicE.setContent("<b>Hi</b>");
}); 

演示

文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM