jQuery Summernote - Get text back into editor

$(".summernote").code("your text");

Since v0.7.0 code() has been deprecated and removed (same story for destroy() method).

You must use $(".summernote").summernote("code", "your text");

Reference: https://summernote.org/getting-started/#get--set-code

After v0.7.0, direct jquery methods, destroy and code were removed for avoiding conflict with other jquery libraries. You can call this methods with summernote api.


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', '<b>hello world</b>');

Source code

Bonus

Clear all editor content:

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

Tags:

Jquery