简体   繁体   中英

Can't seem to find the instance of CKEditor

I created a CKEitor dialog box with the following code

<textarea name="content_html" id="editor1" rows="6" cols=""></textarea>
<script>
        window.onload = function() 
        {
            CKEDITOR.replace( 'editor1' );
        };
</script>

And the Dialog works fine. But when i try to set data for the current instance

<script>
      CKEDITOR.instances['editor1'].setData("hello");
</script>

I get a javascript error : CKEDITOR.instances.editor1 is undefined

Oops! My Mistake. Solved!

<textarea name="content_html" id="editor1" rows="6" cols=""><?php echo $content; ?></textarea>

This solved it!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM