jQuery Summernote - Get text back into editor

前端 未结 6 1005
鱼传尺愫
鱼传尺愫 2021-01-01 12:39

I got problems getting text back into the summernote editor.

I already tried (but did not work):

$(\"#EDITsummernote\").innerHtml = \'test\';
         


        
6条回答
  •  难免孤独
    2021-01-01 13:01

    Insert Text:

    $('#summernote').summernote('editor.insertText', 'hello world');
    

    You can use this line if you want to set (paste) HTML code in editor:

    $('#summernote').summernote('editor.pasteHTML', 'hello world');
    

    Source code

    Bonus

    Clear all editor content:

    $('#summernote').code("");
    

提交回复
热议问题