gpt4 book ai didi

javascript - 如何从 php 中的 suneditor textarea 发送值?

转载 作者:行者123 更新时间:2023-12-04 03:52:46 27 4
gpt4 key购买 nike

我想在 php 中发送 textarea 值 Suneditor

PHP代码

if($_POST["submit"]){
$content = $_POST["txtEditor"];
echo $content;
}

HTML代码

 <form action="" method="post" >
<textarea id="txtEditor" name="txtEditor" style="display:none;"></textarea>
<input type="submit" name="submit" class="submit">
</form>

Javascript

$(document).ready(function() {
$("#txtEditor").Editor();
$('form').submit(function () {
$('#txtEditor').val($('#txtEditor').Editor('getText'));
});
$('#txtEditor').Editor('setText', $('#txtEditor').val());
});

suneditor.create('txtEditor', {
buttonList: [
['undo', 'redo', 'removeFormat'],
[align, font, fontSize, fontColor, hiliteColor],
[horizontalRule, image, template]
],
})

编辑器工作完美。
我哪里做错了?

最佳答案

完整代码

const description = SUNEDITOR.create((document.getElementById('description')),{
buttonList: [
['undo', 'redo'],
['bold', 'underline', 'italic'],
['removeFormat'],
['outdent', 'indent'],
['align', 'list'],
['table'],
['fullScreen', 'showBlocks']
],
lang: SUNEDITOR_LANG['pl']
});
$(window).click(function() {
document.getElementById('description').value = description.getContents();
});

关于javascript - 如何从 php 中的 suneditor textarea 发送值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64214787/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com