首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >清除uikit html编辑器

清除uikit html编辑器
EN

Stack Overflow用户
提问于 2014-12-11 07:06:34
回答 1查看 650关注 0票数 2

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

我试着用这些密码清除它:

代码语言:javascript
复制
 $("#description").val('');
 $('#description').attr('data-uk-htmleditor');
 $.UIkit.htmleditor('#description', { /* options */ });

但还是不起作用。这里有人能帮我吗?编辑:

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

代码语言:javascript
复制
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 */ });

        }
    }); 

}

EN

回答 1

Stack Overflow用户

发布于 2014-12-11 07:19:46

试试这个:

代码语言:javascript
复制
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);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27417160

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档