Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Summernote - Get text back into editor

Tags:

jquery

I got problems getting text back into the summernote editor.

I already tried (but did not work):

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

How to do that?

like image 981
cr1zz Avatar asked Feb 27 '14 12:02

cr1zz


People also ask

How do I get plain text from Summernote editor?

html(text). text(); . Because if you the content of summernote contain some plain text and you don't wrap the whole content inside an HTML tag(like div) then, jQuery will through an error saying it was not expected.

How do I customize my Summernote toolbar?

If you look on the main Summernote website as opposed to the API docs you will see a clear example, that explains how to customise the toolbar. It is on the Deep Dive page and scroll down to Custom Toolbar. It also lists the available toolbar buttons. In your toolbar you set ['style', ['bold', 'italic',...


1 Answers

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.

like image 190
Mathieu Castets Avatar answered Sep 16 '22 18:09

Mathieu Castets