lezhni
lezhni

Reputation: 304

CKEditor jquery doesn't update values

I have some CKEditor textareas like this:

<textarea id="ckedittext" name="params[somenumber]"></textarea>

Then I execute Jquery code to update textareas value:

$('#ckedittext').each(function() {
    var name = $(this).attr('name');
    CKEDITOR.instances[name].updateElement();
});

But this code doesn't work! I have no idea how to fix this problem, please help me somebody.

Thanks

Upvotes: 0

Views: 4073

Answers (1)

epascarello
epascarello

Reputation: 207501

Give your elements a common class and use a class selector.

<textarea id="ckedittext" class="editor" name="params[somenumber]"></textarea>

and

$('.editor').each(function() {
    var name = $(this).attr('name');
    CKEDITOR.instances[name].updateElement();
});

Upvotes: 2

Related Questions