JSFiddle - React, Tailwind, and code Playground

by Felipe Kautzmann

JavaScript

function addListItem(event) {
    if(event.which == 13){
        var text = $("#new-text").val();
    
        $("#todolist").append('<li><input type="checkbox" class="done"/>'+text+'<button                  class="delete">Delete</button></li>');
    $("#new-text").val('');
}

$(function() {
    $("#add").on('keypress' , addListItem(this));
}