Hi,
My whole test site is here. The goal is when you click on a row, you can edit that text. That works actually, when you click on "sluiten" it will be updated.
Now i use this code:
var z = 1; $.each($('div.contentblock'), function() { var contentblock = z++; $(this).addClass('contentblock_' + contentblock); $('<textarea name="inhoud_' + contentblock + '" />').appendTo('div#popup'); CKEDITOR.replace('inhoud_' + contentblock, { skin : 'office2003', filebrowserBrowseUrl : '/admin/includes/pdw_file_browser/index.php?editor=ckeditor', filebrowserImageBrowseUrl : '/admin/includes/pdw_file_browser/index.php?editor=ckeditor&filter=image', filebrowserFlashBrowseUrl : '/admin/includes/pdw_file_browser/index.php?editor=ckeditor&filter=flash', } ); $('div.contentblock_' + contentblock).click(function(){ $('div#overlay').fadeIn(750); $('div#popup').fadeIn(); $('div#popup').draggable(); if(!$('div.contentblock_' + contentblock).html() == ''){ if(contentblock == '1'){ CKEDITOR.instances.inhoud_1.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '2'){ CKEDITOR.instances.inhoud_2.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '3'){ CKEDITOR.instances.inhoud_3.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '4'){ CKEDITOR.instances.inhoud_4.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '5'){ CKEDITOR.instances.inhoud_5.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '6'){ CKEDITOR.instances.inhoud_6.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '7'){ CKEDITOR.instances.inhoud_7.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '8'){ CKEDITOR.instances.inhoud_8.setData($('div.contentblock_' + contentblock).html()); } if(contentblock == '9'){ CKEDITOR.instances.inhoud_9.setData($('div.contentblock_' + contentblock).html()); } } $('span#cke_inhoud_' + contentblock).show(); $('span#sluiten').click(function(){ if(!$('div.contentblock_' + contentblock).html() == ''){ if(contentblock == '1'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_1.getData()); } if(contentblock == '2'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_2.getData()); } if(contentblock == '3'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_3.getData()); } if(contentblock == '4'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_4.getData()); } if(contentblock == '5'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_5.getData()); } if(contentblock == '6'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_6.getData()); } if(contentblock == '7'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_7.getData()); } if(contentblock == '8'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_8.getData()); } if(contentblock == '9'){ $('div.contentblock_' + contentblock).html(CKEDITOR.instances.inhoud_9.getData()); } } $('span#cke_inhoud_' + contentblock).hide(); $('div#popup').hide(); $('div#overlay').hide(); }); }); }); $('<span id="sluiten">sluiten</span>').appendTo('div#popup');
Re: instance name of CKEDITOR
I fixed it myself
Solution for variable instance names: