开发者

Getting textarea value in javascript

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开发者_StackOverflow can get the entire value.


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜