亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 php 的響應式 WYSIWYG 文本編輯器中設置默認值

如何在 php 的響應式 WYSIWYG 文本編輯器中設置默認值

PHP
qq_遁去的一_1 2021-12-03 18:46:29
我正在使用響應式 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不熟悉。謝謝
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

  $(document).ready(function() {

                var myEditor  = $("#txtEditor"); 

                myEditor.Editor();


// set initial  text in editor

                myEditor.Editor("setText", "text <?php echo time(); ?>");

// copy editor content to textarea

                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)

 $(".Editor-editor").keyup(function(){

                myEditor.text(myEditor.Editor("getText"));

                });

// better is use same action when onsubmit form, or click in Save button


                });

在提交表單之前,您應該將文本從編輯器復制到 textarea


$('#txtEditor').text($('#txtEditor').Editor("getText"));


查看完整回答
反對 回復 2021-12-03
  • 1 回答
  • 0 關注
  • 220 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號