jquery: getting contents of #content field on post page

The div #editorcontainer contains a regular textarea #content and an iframe #content_ifr.

The #content is filled with the saved contents of the post when the page loads. This means that any live edits of the content won’t be returned when calling jQuery("#content").html(). For the same reason, you get an empty string in the case of a new post.

Where you really need to look for the live updated contents is in the iframe, which is used by the WYSIWYG editor. Here’s how:

jQuery('#content_ifr').contents().find('#tinymce').html();

Also see: jquery/javascript: accessing contents of an iframe.