balexander balexander -4 years ago 207
jQuery Question

Using JQuery to set CKEditor Value

I have a CKEditor textarea:

<textarea cols="80" id="taBody" name="taBody" class="ckeditor" rows="10" runat="server"></textarea>

I have jQuery trying to set the value from the database:


Don't worry about the substring I already tested that it is returning a string. For testing purposes I replaced the substring with 'test' and was receiving the same issue.

I know that the jquery surrounding this line doesn't affect it because the other textfields I'm trying to populate work. Just when it comes to the ckeditor.

Here is the script in whole:

function (obj) {
type: "POST",
url: "ContentSections.aspx/GetContentDetails",
data: '{"nodeID": "' + obj.attr('id') + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var str = msg.d;
var substr = str.split('|||');


The issue was that nothing was being populated and no javascript errors were being shown.

I tried to read around but couldn't find anything that helped me. Does anyone have any ideas?

Answer Source

You need to use CKEditor's API instead.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download