[英]how to get value from textarea ckeditor
I am new to ckeditor, at moment I am writting a demo code on ckeditor. Could someone please help me how to get value from texterea ckeditor. Here below is my code我是 ckeditor 的新手,目前我正在 ckeditor 上编写演示代码。有人可以帮助我如何从 texterea ckeditor 获取价值。下面是我的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CKEditor 4</title>
</head>
<body>
<textarea id="idDemo" name="demo"></textarea>
<input type="button" value="Get Data" onclick="myFunction()" />
<script>
function myFunction() {
var content = $('idDemo').val();
alert(content);
}
</script>
<script src="ckeditor/ckeditor.js"></script>
<script>CKEDITOR.replace('demo');</script>
</body>
</html>
According to the documentation , this should do the trick.根据文档,这应该可以解决问题。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CKEditor 4</title>
</head>
<body>
<textarea id="idDemo" name="demo"></textarea>
<input type="button" value="Get Data" onclick="myFunction()" />
<script>
function myFunction() {
var content= CKEDITOR.instances.editor1.getData();
alert(content);
}
</script>
<script src="ckeditor/ckeditor.js"></script>
<script>CKEDITOR.replace('demo');</script>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.