jqueryajaxtextareawymeditor

wymeditor set value?


I am trying to set the value of wymeditor textarea,
in API documentation, to set or get the value, the code below is given;

wym.html("<p>Hello, World.</p>");

but this code is not working.

How can I set the value of wymeditor textarea?

thanks.


Solution

  • That code will actually work, assuming that the value of wym is the appropriate WYMeditor instance. For example, something like this will work:

    jQuery('.my-text-area').wymeditor();
    myWym = jQuery.wymeditors(0);
    myWym.html('<p>initial html</p>');
    

    You can also just put the HTML you'd like to start with as the contents of your text area before you initialize wymeditor.