就JS来说,我是一个学习者,虽然我已经花了几个小时阅读有很多帮助的教程,但我仍然无法确定如何找出用户在ckeditor textarea中输入的内容.
我正在尝试做的是,当有人键入textarea时,无论他们键入什么,都会出现在页面不同部分的div中.
我有一个简单的文本输入做得很好,但因为文本区域是一个ckEditor类似的代码不起作用.
我知道答案就在这里:ckEditor API textarea值,但我不知道要弄清楚我的意图.我不认为有人会帮助我吗?
我工作的代码是:
$('#CampaignTitle').bind("propertychange input", function() {
$('#titleBar').text(this.value);
});
Run Code Online (Sandbox Code Playgroud)
和
<label for="CampaignTitle">Title</label>
<input name="data[Campaign][title]" type="text" id="CampaignTitle" />
Run Code Online (Sandbox Code Playgroud)
和
<div id="titleBar" style="max-width:960px; max-height:76px;"></div>
Run Code Online (Sandbox Code Playgroud) 我有这段代码可以从他们的网站启用 CKEditor,但我不知道如何与其交互。如何使用 javascript 或 jquery 从中获取数据?
ClassicEditor
.create(document.querySelector('#editor'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.ckeditor.com/ckeditor5/10.0.1/classic/ckeditor.js"></script>
<textarea name="content" id="editor">
<p>Here goes the initial content of the editor.</p>
</textarea>Run Code Online (Sandbox Code Playgroud)