new task redone

This commit is contained in:
Paul Liverman III 2018-04-24 16:46:09 -07:00
parent 2d64d6ca63
commit 6db5e9c7c8

View File

@ -18,14 +18,13 @@ function new_task() {
let template = $("#task-template").html();
template = $(template);
$.post("/v1/new", {api_key: API_KEY, content: input.val()}, function(data) {
// $("#new-task").before("<li><input type='checkbox' id='task-" + data.task.id + "' onchange='check(" + data.task.id + ")'> " + data.task.content + "</li>");
let input = $("input", template);
input.prop("id", "task-" + data.task.id);
// input.prop("onchange", "check('" + data.task.id + "')");
input.change(function() {
check(data.task.id);
});
input.after(data.task.content); // NOTE not sure if will work
input.next().replace(" " + data.task.content);
$("#new-task").before(template);
})
.fail(function(request) {