Try
Html
<ul class="namelist">
<li>Liam</li>
<li>Noah</li>
<li>William</li>
<li>James</li>
<li>Oliver</li>
<li>Benjamin</li>
<li>Elijah</li>
<li>Lucas</li>
</ul>
<div id="divShow">
</div>
Jquery
<script>
$('.namelist li').click(e=>{
localStorage.setItem($(e.currentTarget).text(), $(e.currentTarget).text());
$('#divShow').append('<p>'+$(e.currentTarget).text()+'</p>');
});
</script>
3
solved I have a list of names as