Fiks,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
var arr = JSON.parse(window.localStorage.getItem('arr') || "[]");
$('#send').on('click', function() {
var tr=$('#test').val().trim();
if(tr.length) {
arr.push(tr);
window.localStorage.setItem('arr', JSON.stringify(arr));
}
alert(JSON.stringify(arr));
});
});
</script>
</head>
<body>
<input id="test">
<button type="submit" id="send">Send</button>
<div id="todos"></div>
</body>
</html>