如何用jquery清除ckeditor

use*_*293 13 jquery ckeditor

如何通过点击按钮/链接清除ckeditor textarea与jquery?

我试过这个:当我在PHP中初始化编辑器时$("textarea.editor").val('');,$("textarea.editor1").val('');我尝试使用最后的1$ckeditor->editor('editor1', $nDetails);

任何帮助将不胜感激.

<p>Details: 

    <?php

    // Helper function for this sample file.
    function printNotFound( $ver )
    {
        static $warned;

        if (!empty($warned))
            return;

        echo '<p><br><strong><span class="error">Error</span>: '.$ver.' not found</strong>. ' .
            'This sample assumes that '.$ver.' (not included with CKFinder) is installed in ' .
            'the "ckeditor" sibling folder of the CKFinder installation folder. If you have it installed in ' .
            'a different place, just edit this file, changing the wrong paths in the include ' .
            '(line 57) and the "basePath" values (line 70).</p>' ;
        $warned = true;
    }



    include_once '../ckeditor/ckeditor.php' ;
    require_once '../ckfinder/ckfinder.php' ;

    // This is a check for the CKEditor class. If not defined, the paths in lines 57 and 70 must be checked.
    if (!class_exists('CKEditor'))
    {
        printNotFound('CKEditor');
    }
    else
    {
        $initialValue = $pageContent;

        $ckeditor = new CKEditor( ) ;
        $ckeditor->basePath = '../ckeditor/' ;

        // Just call CKFinder::SetupCKEditor before calling editor(), replace() or replaceAll()
        // in CKEditor. The second parameter (optional), is the path for the
        // CKFinder installation (default = "/ckfinder/").
        CKFinder::SetupCKEditor( $ckeditor, '/ckfinder/' ) ;

        $ckeditor->editor('editor1', $nDetails);
    }

    ?></p>
Run Code Online (Sandbox Code Playgroud)

gho*_*der 46

CKEDITOR.instances.editor1.setData('');

其中editor1是您的CKEDITOR字段的id


Aar*_*thi 15

下面的代码清除了ckeditor textarea中的值.这也将工作4.4版本.

      CKEDITOR.instances['content'].setData('');
Run Code Online (Sandbox Code Playgroud)

内容是特定文本区域的ID.