Set wysiwyg's value with javascript How do I set a WYSIWYG's value with javascript? does the WYSIWYG module provide an api for this? 

I don't know which editor user is using, so I can't use the api of editors.
The following code worked perfectly fine for me,

(function($) {
    $(document).ready(function() {
      $("#edit-body-und-0-value").val('this is a test content.');
    });
})(jQuery);


I have placed this code is test.js file. 'edit-body-und-0-value' is the ID of the textarea.

I have installed WYSIWYG module and placed CKEditor under sites/all/libraries/ckeditor folder. Although it doesn't matter if you are using CKEditor or any other editor because we are mainly referring to ID of our textarea.