JSFiddle - React, Tailwind, and code Playground

HTML

<body>

<form id="form" action="#" method="POST">
<input id="description" name="description" type="text" />
<input id="add" type="submit" value="Add" />
<button id="clear">Clear All</button>
</form>
<div id="alert"></div>
<ul id="keyWords"></ul>

<div><p>this is some sample text</p></div>
<div><p>Justin Beiber is cool</p></div>
<div><p>I dont understand why people follow Kim Kardashian</p></div>
<div><p>This is another sample paragraph</p></div>
</body>

JavaScript

keyWordArray = [];
//if the existing local storage was not an array, delete it
if(localStorage["keyWords"].substr(0,1) != '[') {
	//empty local storage
	localStorage["keyWords"] = '';
} else {
	//parse the array, and store it in keyWordArray
	keyWordArray = JSON.parse(localStorage["keyWords"]);
}



$(document).ready(function () {

	$('#add').click( function() {
  	var Description = $('#description').val();
  	if($("#description").val() === '') {
    	$('#alert').html("<strong>Warning!</strong> You left the to-do empty");
    	$('#alert').fadeIn().delay(1000).fadeOut();
    	return false;
		}
   
   	$('#form')[0].reset();
   	var keyWords = $('#keyWords').html();
   	
    //add the new keyword to the array
    keyWordArray.push(Description);
    //overwrite the array in localStorage with the new, updated array
   	localStorage["keyWords"] = JSON.stringify(keyWordArray);
    //call loadKeyWords() to rebuild the UL and hide any matching elements
   	loadKeyWords();
   	return false;
	});


	function loadKeyWords() {
  	//clear the existing data
		$('#keyWords').html('');
    //for all the items in the array...
		for(var i = 0; i < keyWordArray.length; i++) {
    	//add them to the UL
			$('#keyWords').append('<li><input id="check" name="check" type="checkbox">'+keyWordArray[i]+'</li>');
      //and hide any DOM elements that have the keyword
      $("div:contains('"+keyWordArray[i]+"')").hide();    
		}
	}

	$('#clear').click( function() {
		window.localStorage.clear();
		location.reload();
		return false;
	});

	loadKeyWords();
}); //end of document ready function