首页 > 解决方案 > 如何将文本从可编辑的 div 附加到 textarea jquery?

问题描述

我正在尝试将文本从可编辑附加divtextarea. 我将 TinyMCE WYSIWYG 与textarea.

$('#insert').click(function() {
  // var contentArea =
  var modalContent = $('#mdoalTextArea').text();
  $('#contentTextArea').append(modalContent);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div contenteditable="true" id="mdoalTextArea" class="form-control" style="height: 100%;">
  This text can be edited by the user.
</div>

<textarea name="contents" id="contentTextArea" cols="30" rows="10"></textarea>

<button type="button" id="insert" class="btn btn-success">Save</button>

标签: javascriptjquery

解决方案


推荐阅读