javascript - 如何将文本从可编辑的 div 附加到 textarea jquery?
问题描述
我正在尝试将文本从可编辑附加div
到textarea
. 我将 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>
解决方案
推荐阅读
- javascript - USSD应用中是否可以获取经纬度
- docker - 在本地 docker run 上使用谷歌默认凭据
- ruby-on-rails - 使用 Ruby on Rails 同时发送数千个请求?
- php - PHP 7.4 fpm-alpine Docker 容器以代码 70 退出
- visual-studio - Azure 未在 Visual Studio SSIS 工具箱中启用
- python - 如何在python屏幕中的特定列之间打印?
- android - Android OssLicensesMenuActivity 在启动时崩溃
- android - 在 Android Java 中将 EditText 的提示移到顶部
- java - NullPointerException:尝试执行 MongoDB FindByID 时为 null
- jsf - 从 PrimeFaces 7 更新到 8 后,对话框中的 PrimeFaces TextEditor 出现问题