首页 > 解决方案 > 如何从 API 响应中清除我的模板设置为 #comments-list 的所有数据

问题描述

var showResults = function (title, overview,picture,pictureBack) {
    var $template = $('#comment-template').html();
    $template = $($template);

    $template.find('h4').text(title);
    $template.find('p').text(overview);
    $template.find('#pic').append(picture);
    $template.find('#picBack').append(pictureBack);

    var $commentsList = $("#comments-list");
    $commentsList.append($template);
}

我想通过单击进行研究的按钮来重置模板

标签: javascriptjquery

解决方案


推荐阅读