views:

85

answers:

2

Iam using Tinymce Editor for creating some content.I used textarea for getting tinymce editor.

For edting i have used this code

<textarea id="page_content_id" name="page_content"><?php echo $page_content;?></textarea>

So the saved value will be in tiny mce editor.If i add something to the editor how i can get the values in javascript using

document.getElementById("page_content_id").value

This wont give the new value.How i can get the entire value.Thanks in advance

+4  A: 
<textarea id="page_content_id" name="page_content" cols="50" rows="15">This is some content that will be editable with TinyMCE.</textarea>

<script language="javascript" type="text/javascript">
function ShowHTML(mceId)
{
    alert( tinyMCE.get(mceId).getContent() );
}
</script>

<input type="button" value="ShowHTML" onclick="ShowHTML('page_content_id');">

or use .getHTML();

Oyeme
Thanks Oyeme.It is working in ie and firefox
THOmas
+2  A: 

You can get the value in javascript by using the following

tinyMCE.activeEditor.getContent();

If you have multiple editors open at the same time, use

tinyMCE.get(idOfEditor).getContent();
samy