JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://moskah.nl/jquery.cookie.js"></script>
<ul class="jq-text">
 </ul>

    <form action="" method="get" id="form1">
        <div class="fields">
            <input type="text" id="inputBox" />
            <a href="">Save</a>
        </div>
    </form>

CSS

li { width: 200px; }

JavaScript

$(document).ready(function() {

    var cookie = $.cookie('myDemoCookie');
    var attrCookie = $.cookie('attrCookie');

    // If the cookie has been set in a previous page load, show it in the div directly:
    if (cookie){
        var values = $.parseJSON(cookie);
        var li;
        for (var v in values) {
            li = $('<li><a href="' + values[v]+ '">' + values[v] + '</a></li>');
            
            $('.jq-text').append(li).show();
        }
    }

    $('.fields a').click(function(e) {
        var text = $('#inputBox').val();
        var values = $.parseJSON($.cookie('myDemoCookie'));
        if (!values) {
            values = [];
        }
        values.push(text);
        console.log(values);
        // Setting a cookie with a seven day validity:
        $.cookie('myDemoCookie',JSON.stringify(values),{expires: 7, path: '/' });


        
        
$(".jq-text").append('<li><a href="' + text + '">' + text + '</a></li>');
        
        e.preventDefault();
        
      


    });
    
    
    
    
    
    
    
$('.jq-text li').click(function(e) {

          
    $.cookie("myDemoCookie", null);
    
     });
    
    
    
    
    
    $('#form1').submit(function(e){ e.preventDefault(); })
})