How do I retrieve the contents of a Quill text editor How do I retrieve the contents of a Quill text editor javascript javascript

How do I retrieve the contents of a Quill text editor


Depends what you want to get, here's an example showing a few ways:

http://codepen.io/k3no/pen/amwpqk

var delta = editor.getContents();var text = editor.getText();var justHtml = editor.root.innerHTML;preciousContent.innerHTML = JSON.stringify(delta);justTextContent.innerHTML = text;justHtmlContent.innerHTML = justHtml;


Quite simply by accessing the editor's innerHTML:

var quill = new Quill('#editor', {    theme: 'snow'});// ....var editor_content = quill.container.innerHTML // or quill.container.firstChild.innerHTML could also work

Hope this helps!