admin管理员组

文章数量:1406031

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.

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.

Share Improve this question edited Dec 24, 2012 at 22:00 hakre 199k55 gold badges450 silver badges856 bronze badges asked Sep 21, 2010 at 6:45 Shinu ThomasShinu Thomas 5,31612 gold badges62 silver badges88 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6
<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();

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();

本文标签: phpGetting textarea value in javascriptStack Overflow