如何在 php 的响应式 WYSIWYG 文本编辑器中设置默认值

我正在使用响应式 WYSIWYG 文本编辑器。我想将默认值放在其编辑器中以更新数据。当我检查时,我得到这样的值:

<div id="txtEditor" style="display: none;">Test terms</div>

编辑器 div 变成另一个 div,如:

<div class="Editor-editor" contenteditable="true" style="overflow: auto;"></div>

那么我怎样才能把我的<?php echo 'text'; ?>内部Editor-editordiv 。请帮我弄清楚这件事。我对js不熟悉。谢谢


qq_遁去的一_1
浏览 199回答 1
1回答

千万里不及你

&nbsp; $(document).ready(function() {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var myEditor&nbsp; = $("#txtEditor");&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myEditor.Editor();// set initial&nbsp; text in editor&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myEditor.Editor("setText", "text <?php echo time(); ?>");// copy editor content to textarea&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myEditor.text(myEditor.Editor("getText"));// copy editor content to textarea when keyup (is not recommended)// fire only if you typing in editor not detect toolbars actions (eg. bolding)&nbsp;$(".Editor-editor").keyup(function(){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myEditor.text(myEditor.Editor("getText"));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });// better is use same action when onsubmit form, or click in Save button&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });在提交表单之前,您应该将文本从编辑器复制到 textarea$('#txtEditor').text($('#txtEditor').Editor("getText"));
打开App,查看更多内容
随时随地看视频慕课网APP