How can i get content of CKEditor using JQuery?

前端 未结 15 1797
甜味超标
甜味超标 2020-12-04 15:21

I\'m using CKEditor. I am saving the form values with ajax using page methods.

But the content of CKEditor value cannot be saving into the table.

I dont post

相关标签:
15条回答
  • 2020-12-04 16:08

    version 4.6

    CKEDITOR.instances.editor.getData()
    
    0 讨论(0)
  • 2020-12-04 16:10
    var value = CKEDITOR.instances['YourInstanceName'].getData()
     alert( value);
    

    Replace YourInstanceName with the name of your instance and you will get the desired results.

    0 讨论(0)
  • 2020-12-04 16:13

    use the CKEditor.editor.getData() call on the instance. That is to say:

    HTML

    <textarea id="my-editor">
    <input id="send" type="button" value="Send">
    

    JS for CKEditor 4.0.x

    $('#send').click(function() {
        var value = CKEDITOR.instances['DOM-ID-HERE'].getData()
        // send your ajax request with value
        // profit!
    });
    

    JS for CKEditor 3.6.x

    var editor = CKEDITOR.editor.replace('my-editor');
    
    $('#send').click(function() {
        var value = editor.getData();
        // send your ajax request with value
        // profit!
    });
    
    0 讨论(0)
提交回复
热议问题