JSFiddle - React, Tailwind, and code Playground

by dodozhang21

HTML

<a href="#" class="deleteWithOn">delete with on</a>
<br />
<a href="#" class="deleteWithLive">delete with live</a>
<br />
<a href="#" class="deleteWithOnTwo">delete with on (the right way)</a>

<br/>
<div id="dynoDeletes"></div>
<span id="insertOtherDeletesDynamically">Insert new delete links dynamically</span>

JavaScript

$(document).ready(function(){
    
    $('a.deleteWithLive').live('click', function(event) {
        console.log('live in click');
    });
    
    $('a.deleteWithOn').on('click', function(event) {
        console.log('on in click');
    });
    
    $(document).on('click', 'a.deleteWithOnTwo', function(event) {
        console.log('on in click two');
    });
    
    $('#insertOtherDeletesDynamically').click(function() {
        $('#dynoDeletes').html('<a href="#" class="deleteWithOn">delete with on</a><br/><a href="#" class="deleteWithLive">delete with live</a><br/><a href="#" class="deleteWithOnTwo">delete with on (the right way)</a>');
    });
    
});