Search code examples
jqueryhtmlyuitext-editortextarea

How do I programmatically (via JQuery) set the content of the YUI text editor?


I expect this is a newbie question despite smashing my head against the YUI documentation.

I have a page with a YUI Simple Editor (called 'myEditor'). It hooks to a text area called 'posttext'. New editing is fine, but the problem I am solving right now involves the user clicking on one or more existing elements, and putting that text into the editor for revision/resubmission.

What I would like to do is set the contents programmatically via JQuery. I've set the value without an issue, and I can see that it's set in firebug, but I expect there's some method of the editor itself that I need to run to get it to redisplay (I tried re-running the render method to no avail).


Solution

  • The function is named setEditorHTML()

    See this example from the YUI Editor examples, third code block ("Now handle the toggle").