So, what i am attempting to do is adding a Javascript snippet in wordpress admin new publish page, to ensure that after i click a control button it fills in the CONTENT textarea in which the body from the publish goes. Adding it's not an issue, i have already carried this out, but for whatever reason filling this content area does not work.

The textarea in the wordpress admin page is:

<textarea rows='10' class='theEditor' cols='40' name='content' tabindex='2' id='content'></textarea>

Also i attempted to fill the Publish_TITLE input and delay pills work fine. I understand the issue might range from JS scripts of wordpress for that content area, since it is not really a simple textarea, it is a JS text editor. Any suggestions? And also the JS snippet is:

<script type="text/javascript">

    $("form").submit(function(){
        $("input[name$='post_title']").val("a letter");
        document.getElementById('content').innerHTML = "testing";
        return false;
    });

</script>

PS: jquery library already incorporated

Use [cde] to create (or get) the need for a port type element, including .val() and <textarea>, such as this:

<select>

You should not mix jQuery and standard dom calls? Do this:

$("form").submit(function(){
    $("input[name$='post_title']").val("a letter");
    $('#content').val("testing");
    return false;
});

Labored acceptable for me in the Firebug console.

Update: Sorry men, skipped the part it's TinyMCE we are speaking about. Here's the code that needs to be accustomed to update both hidden textarea And also the visual editor itself:

$("#content").text("hi");

For more information browse the TinyMCE Commands API