JSFiddle - React, Tailwind, and code Playground

by DinoMyte

HTML

<ul>

</ul>
<input type="button" value="click to add li">

CSS

.h1
{
  border: 1px solid blue;
}

.h2
{
  background-color: yellow;
}

JavaScript

var num = 0;
$('input:button').click(function()
{
  num++;
  $('ul').append('<li id=' + num + '>' + num + '</li>');
});


  $(document).on("click", 'ul',function(){    
    var name = $(this).find('li#' + num).html();
    alert(name);
  });