How to check whether CKEditor has some text in it?

后端 未结 6 1549
时光取名叫无心
时光取名叫无心 2021-02-04 02:08

I have an HTML form with a few fields. One of them is a textarea managed by CKEditor.

When the user wants to submit the form, I want to check whether he entered values

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 02:21

    CKeditor has its own built in function for retrieving data in a text editor:

    function CheckForm(theForm) 
    {
        textbox_data = CKEDITOR.instances.mytextbox.getData();
        if (textbox_data==='')
        {
            alert('please enter a comment');
        }
    }
    

    Documentation

提交回复
热议问题