gpt4 book ai didi

javascript - 清除 uikit html 编辑器

转载 作者:行者123 更新时间:2023-11-27 23:50:56 26 4
gpt4 key购买 nike

我试图在保存关闭/取消模式时的数据后清除我的uikit html 编辑器的内容。

我尝试用这些代码清除它:

 $("#description").val('');
$('#description').attr('data-uk-htmleditor');
$.UIkit.htmleditor('#description', { /* options */ });

但是还是不行。这里有人可以帮助我吗?编辑:

这是我从数据库中提取数据的其他代码:

function editTask(id){
key = id;
s_type = 'u';
console.log(s_type);
enableForm('#task');

$('#btn-save-task').hide();
$('#btn-save-edited-task,#btn-cancel-task').show();
$.ajax({
type: "GET",
url: baseUrl+"/opportunities/getInfo/task/"+id,
async : true,
data : {

getType : "getTask"

},
dataType: 'json',
error : function(req,error){
notify(req.statusText,'warning');
},
success: function(data){
$("#taskDescription").val(data.description);
$('#taskDescription').attr('data-uk-htmleditor');
$.UIkit.htmleditor('#taskDescription', { /* options */ });

}
});

最佳答案

试试这个:

var task = '';
function editTask(id) {
key = id;
s_type = 'u';
console.log(s_type);
enableForm('#task');

$('#btn-save-task').hide();
$('#btn-save-edited-task,#btn-cancel-task').show();
$.ajax({
type: "GET",
url: baseUrl + "/opportunities/getInfo/task/" + id,
async: true,
data: {

getType: "getTask"

},
dataType: 'json',
error: function(req, error) {
notify(req.statusText, 'warning');
},
success: function(data) {
task = data.description;
}
});
}

$.UIkit.htmleditor('#taskDescription', { /* options */ });

//Get a reference to the CodeMirror editor
var editor = $('.CodeMirror')[0].CodeMirror;

//You can then use it as you wish
editor.setValue(task);

关于javascript - 清除 uikit html 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27417160/

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