JSFiddle - React, Tailwind, and code Playground

by Spring

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Javascript todo list.</title>
       
        <body>
            
            <div id = "site-wrap">
               
                
                
                 <h3>Click on the specfic element in the todo list you wish to delete.</h3>
                <textarea placeholder="Describe yourself with 4 words...">
                </textarea><br />
                <input type = "submit" value ="Add"/>
                <ul id = "todo">
                    <li>
                        Todo..
                    </li>
                    
                    <li>
                        Todo..
                    </li>
                </ul>
                <div style="clear:both;"></div>
            
            </div>
        </body>
    </head>
</html>

CSS

#site-wrap{
                width:400px;
                height:150px;
                margin:0 auto;
                padding:10px;
            }
            
            ul{
                margin-bottom:50px;
                float:right;
                margin:0 50px 30px 0;
            }
            
            textarea{
                float:left;
            }

JavaScript

$(document).ready(function() {

    var todoList = {
        remove: function(obj) {
            $(obj).remove();
        },

        add: function(str) {
            if (str !== '' || str !== undefined) {
                $("#todo").append("<li>" + str + "</li>");
            }
        }
    };

    $("#todo li").live("click", function() {
        todoList.remove($(this));
    });

    $("input").live("click", function() {
        todoList.add($("textarea").val());

    });

});