📜  删除附加元素 jquery - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:15.701000             🧑  作者: Mango

代码示例4
$(document).ready(function () {
    $("#add").click(function () {
        var newToDo = $("#newToDo").val();
        if(newToDo.length > 0){
            var anotherToDo = $("

" + newToDo + "

"); $("#toDoList").append(anotherToDo); $("#newToDo").val(" "); // later when you want to delete it anotherToDo.remove(); } }); });