简体   繁体   中英

Unable to set NiceEditor content in Web Browser COntrol

I am using NiceEdtor on Web Browser control. on jQuery ready() function I am trying to set content of it and in result I get following error:

Object doesn't support property or method 'setContent'

Below is my given Code:

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

Text area is defined as following:

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

You need to instantiate the textarea to niceEditor control using nicEditors.allTextAreas(); or 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>");
}); 

Demo

Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM