Search code examples
javascriptjqueryeditorwysiwygwysihtml5

Programmatically retrieve content from WYSIHTML5 editor


How do I programmatically retrieve content from a WYSIHTML5 editor? Suppose the editor is instantiated as this:

var editor = new wysihtml5.Editor
(
   $(this.el).find('textarea').get(0),
   {
      toolbar:      "toolbar",
      parserRules:  wysihtml5ParserRules
   }
);

i would like to get the editor's content on blur event

editor.on
(
   "blur",
   function()
   {
      //what here?
   }
);

Solution

  • It's much better to use the API editor.getValue()

    (@dalen mentioned this in the comment above)