should correct new-task errors

This commit is contained in:
Paul Liverman III 2018-04-24 16:42:01 -07:00
parent 3b90245740
commit 2d64d6ca63

View File

@ -20,11 +20,13 @@ function new_task() {
$.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);
console.log(input);
input.prop("id", "task-" + data.task.id);
input.prop("onchange", "check('" + data.task.id + "')");
input.after(data.task.content); // not sure if will work
console.log(input);
// 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
$("#new-task").before(template);
})
.fail(function(request) {
// TODO handle error