title: CK Editor is not working when use it inside a ajax popup
body: <p>In my project CKEditor is used for richtext interface. the problem is:-
  i have a jquery popup box. before showing this popup box i made a ajax call to server for fetching records after fetching records it show a edit interface for editing record there is a textarea  which i need to integrate CKEditor. when i integrate the editor the text area is successfully changing to editor but it is not showing text inside the text area. i can see the textarea is filled with text in firebug but the editor is blank and unable to edit.</p>
  
  <p>Here is my code</p>
  
  <p>This is main page</p>
  
  <pre><code>&lt;?php $this-&gt;load-&gt;view('menu'); ?&gt;
  &lt;div id="rightContent"&gt;
      &lt;h3&gt;Events&amp;nbsp;&amp;&amp;nbsp;News&lt;/h3&gt;
      &lt;div align="right"&gt;
      &lt;?php echo anchor('eventsandnews/add','ADD NEW',array('class'=&gt;'button')); ?&gt;
      &lt;/div&gt;
          &lt;div class="sukses" style="display:none;"&gt;
  
          &lt;/div&gt;
          &lt;table class="data"&gt;
              &lt;tr class="data"&gt;
                  &lt;th class="data" width="30"&gt;No&lt;/th&gt;
                  &lt;th class="data"&gt;Text&lt;/th&gt;
                  &lt;th class="data"&gt;Date&lt;/th&gt;
                  &lt;th class="data" width="75"&gt;Actions&lt;/th&gt;
              &lt;/tr&gt;
              &lt;?php 
              $i=1;
              foreach ($query-&gt;result() as $row){ ?&gt;
              &lt;tr class="data" id="an&lt;?php echo $row-&gt;id; ?&gt;"&gt;
                  &lt;td class="data" width="30"&gt;&lt;?php echo $i; ?&gt;&lt;/td&gt;
                  &lt;td class="data"&gt;&lt;?php echo substr($row-&gt;newstxt,0,30); ?&gt;&lt;/td&gt;
                  &lt;td class="data"&gt;&lt;?php echo $row-&gt;ndate; ?&gt;&lt;/td&gt;
                  &lt;td class="data" width="75"&gt;
                  &lt;center&gt;
                  &lt;a href="&lt;?php echo $row-&gt;id; ?&gt;" id="edit" class="edit" name="edit"&gt;&lt;img src="&lt;?php echo base_url(); ?&gt;mos-css/img/edit.png"&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;a href="&lt;?php echo $row-&gt;id; ?&gt;" id="delete" class="delete" name="delete"&gt;&lt;img src="&lt;?php echo base_url(); ?&gt;mos-css/img/delete.png"&gt;&lt;/a&gt;
                  &lt;/center&gt;               &lt;/td&gt;
              &lt;/tr&gt;
              &lt;?php
              $i++;
               } ?&gt;
          &lt;/table&gt;
          &lt;div id="paging"&gt;
          &lt;?php echo $paging; ?&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  &lt;script&gt;
    $(function() {  
    $( "#dialog" ).dialog({
        autoOpen: false,
        height: 350,
        width: 500,
        show: {
          effect: "slide",
          duration: 500
        },
        hide: {
          effect: "slide",
          duration: 500
        }
      });
      $(".edit").click(function(event){
          event.preventDefault();
          var id = $(this).attr("href");      
          $.ajax({
              url: '&lt;?php echo site_url().'eventsandnews/edit/'; ?&gt;'+id,
              success: function(data) {
              $("#dialog").html(data);
              $( "#dialog" ).dialog( "open" );
              debugger;
              CKEDITOR.replace( 'update' );
  
              }
          });
      });
  
      $(".delete").click(function(event){
          event.preventDefault();
          var v = confirm('Are you sure to delete?');
          if(v==true){
              var id = $(this).attr("href");      
              $.ajax({
                  url: '&lt;?php echo site_url().'eventsandnews/delete/'; ?&gt;'+id,
                  success: function(data) {
                      $('.sukses').html('Deleted successfully');
                      $('#an' +id).remove();
                      $('.sukses').show('slow');
                       setTimeout(function() {
                          $('.sukses').hide('slow');
                        }, 2500);
                  }
              });
          }
  
      }); 
  
  
    });
    &lt;/script&gt;
  
  &lt;div id="dialog" title="Edit"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>This is Ajax page</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $( "#eventsandnewsdate" ).datepicker();
      $( "#eventsandnewsdate" ).datepicker( "option", "dateFormat", "dd/mm/yy" );
  
      $("#sub").click(function(){
       var a =    $("#update").val();
          if($.trim(a)==''){
              $('.gagal').html('Must enter a announcement !');
              $('.gagal').show('slow');           
          }else{
              var hiddenid = $('#id').val();
              var text = $('#update').val();
              $.ajax({
                type: "POST",
                url: "&lt;?php echo site_url().'announcements/update/'; ?&gt;",
                data: { id: hiddenid, announce: text }
              }).done(function( msg ) {
                  if(msg==1){
                      $( "#dialog" ).dialog( "close" );
                      setTimeout(function() {
                          document.location.reload();
                       }, 600);
  
                  }
              });
  
              ;
          }       
      });
  });
  &lt;/script&gt;
  &lt;div class="gagal" style="display:none;"&gt;
  
  &lt;/div&gt;
  &lt;table width="95%"&gt;         
              &lt;tr&gt;
                &lt;td&gt;&lt;strong&gt;Annoucement&lt;/strong&gt;&lt;/td&gt;
                &lt;td&gt;&lt;textarea onclick="$('.gagal').hide('slow');" name="update" id="update" &gt;&lt;?php echo $query[0]['atext']; ?&gt;
                &lt;/textarea&gt;&lt;/td&gt;
    &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td width="125"&gt;Date&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="button" class="button" id="sub" name="sub" value="Submit"&gt;
              &lt;input type="hidden" name="id" id="id" value="&lt;?php echo $id; ?&gt;"&gt;
              &lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
  </code></pre>
  
  <p>Can anyone please help me?</p>