JSFiddle - React, Tailwind, and code Playground

HTML

<ul id="my-unordered-list">
<li>Number one</li>
<li>Number two</li>
</ul>
<button class="btn">Add New Line Item</button>

JavaScript

jQuery().ready(function($){
    // Chache variables you reuse.
    $cached_list = $( "#my-unordered-list" );
        
    $cached_list.on( 'click', 'li', function(event) {
        alert('line item was clicked'); // logs the list item that was clicked
    });

    $('.btn').click(function() {
        $cached_list.append( '<li>a new list item!</li>' ); 
    });

        
});