views:

31

answers:

1

Hi I have a div box that opens on my page and then loads a html file which contains CKeditor to deal with the text area. The problem is that if I view the html file in my browser everything works well and I have all the editing options. When I use it in my JS script I get nothing. Can anyone help me please ?

The JS code that does this is here

        $(document).ready(function(){ 

              $('#'+divbox).load('../customer_rm/display_email_send.php', function() {
                      // once loaded 
                    CKEDITOR.replace( 'mail_body' );

and the working HTML file is here

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'&gt;
    <html xmlns='http://www.w3.org/1999/xhtml'&gt;

    <head>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    </head>
    <body>


    <style type='text/css'>
    table.t {border: 1px solid black}
    td, tr {border: 0}

    .bdr {
        border: 4px solid black ;
    }
    .white {
        background-color:#FFF ;
    }

    </style>

    <div align='center'>

    <br><br />

    <table id='t' width='700' border='2' bgcolor='#ccc'>
      <tr >
        <td width='20'>&nbsp;</td>
        <td width='50'>&nbsp;</td>
        <td width='50'>&nbsp;</td>
        <td >&nbsp;</td>
        <td width='20' >&nbsp;</td>    

      </tr>

      <tr>
        <td>&nbsp;</td>
        <td rowspan='3'>
        <input type='button'id='send' value='Send'
        style='width:60px; height:40px '
         /><hr>
        <input type='button' value='Close'
        style='width:60px; height:20px '                        onclick='fadeout()' 
         />
        </td>
        <td><input type='button' value='To :' /></td>
        <td><input type='text' class='white' id='mailto' size='80'  /></td>
        <td>&nbsp;</td>
      </tr> 

      <tr>
        <td>&nbsp;</td>

        <td><input type='button' value='Cc :' /></td>
        <td><input type='text' class='white' id='mailcc' name='mailcc' size='80' /></td>
        <td>&nbsp;</td>
      </tr>  
      <tr>
        <td>&nbsp;</td>

        <td><input type='button' value='Bcc :' id='bcc'  /></td>
        <td><input type='text' class='white' id='mailbcc' size='80' /></td>
        <td>&nbsp;</td>
      </tr>  
      <tr>
        <td>&nbsp;</td>
        <td><input type='button' value='Subject'
        style='width:60px; height:20px '                        onclick='fadeout()' 
         /></td>
        <td colspan='2'><input type='text' class='white' id='subject' size='89' /></td>


        <td>&nbsp;</td>
      </tr>  
      <tr>
        <td>&nbsp;</td>
        <td colspan='3'>
          <textarea  id='mail_body'  class='white'  style='height:380px; width:600px; bgcolor:#fff ' >
          </textarea>
        </td>
        <td>&nbsp;</td>
      </tr>  
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>  
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>  

     </table>


    </div>
+1  A: 

Why not use Jquery to call CKEditor to replace your div...seems much more straightforward:

$( 'textarea' ).ckeditor();

Reference Here: http://ckeditor.com/blog/CKEditor_for_jQuery

bpeterson76