[jQuery] Using CKEDITOR within Tabs plugin

[jQuery] Using CKEDITOR within Tabs plugin


I would like to use CKEDITOR on a textarea field within a form which
is within an Ajax Tab.
I thought the following would work - binding to the Load event, so
CKEDITOR is triggered once the Ajax data is loaded. The form and
texarea on the first Tab.
However, when I click from off this tab to another it leaves the
CKEDITOR tab showing.
$('#tabs2').tabs(
{
remote: true,
load: function(event, ui)
{
CKEDITOR.replace('editor1');
}
});
I through it might be the CKEDITOR, so I got it to trigger only when
on the first Tab.
$('#tabs2').tabs(
{
remote: true, load: function(event, ui)
{
alert('tabs load for' + ui.index);
if(ui.index == 0)
{
alert('running editor');
CKEDITOR.replace('editor1');
}
}
});
However, while this works to allow going to the other tabs, when I
click back on the first tab it loses the plot - not showing the first
tab, and then when clicking other tabs it does things like appending
the Ajax data to the end of the tab, without clearing the original
data.