Amir Abu Shareb
Amir Abu Shareb

Reputation: 164

CKEditor in a bootstrap tab powered by javascript

I have an application with CKEditor in a bootstrap tab, the tabs are powered by javascript, when i initialize CKEditor before initializing the tabs, the tabs only work in Chrome.

i came up with a solution where i initialize CKEditor only when the CKEditor tab are active, but now when i submit the form (all tabs are wrapped in a form) CKEditor does not send it's content with the form.

How can i solve this ?

here is some code:

when i initialize ckeditor before the tabs, the tabs only work in chrome.

$(function(){
  $('.editor').ckeditor();
});

when i initialize ckeditor when it's tab is active it does not send it's content with the form...

$('#ckeditor-tab').click(function(){
  setTimeout(function(){
   $('.editor').ckeditor();
  }, 500);
});

Upvotes: 0

Views: 1303

Answers (1)

Joel Peltonen
Joel Peltonen

Reputation: 13402

Sounds like the textarea below CKEditor isn't being updated. Adding CKEDITOR.instances.yourInstance.updateElement(); before the form submit and it should work.

See http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#updateElement

Upvotes: 2

Related Questions