[英]Getting textarea value in javascript
Iam using Tinymce Editor for creating some content.I used textarea for getting tinymce editor. 我使用Tinymce编辑器创建一些内容。我使用textarea来获取tinymce编辑器。
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 所以保存的值将在微小的mce编辑器中。如果我在编辑器中添加一些东西,我怎样才能在javascript中获取值
document.getElementById("page_content_id").value
This wont give the new value.How i 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();
或者使用
.getHTML();
You can get the value in javascript by using the following 您可以使用以下内容在javascript中获取值
tinyMCE.activeEditor.getContent();
If you have multiple editors open at the same time, use 如果您同时打开多个编辑器,请使用
tinyMCE.get(idOfEditor).getContent();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.