JSFiddle - React, Tailwind, and code Playground

HTML

<p>Type in the box below, an alert will appear</p>
<input type='text' id='x' size='30' class='conv'/><br/><br/>
<button id='btn'>Now Click Me</button><br/><br/>
<div id='mainform'>
</div>

JavaScript

$(document).ready(function() {
    $('button').click(function() {
        var a =  "<p>The boxes below have the same class, thus they should show the alert when you type</p><input type='text' size='30' class='conv' id='a0'/><br/>";
        var b = "<input type='text' size='30' class='conv' id='a1'/><br/>";
        $('#mainform').append(a + b);       
    });
    
    $('#mainform').on('keyup','.conv',function() {
     console.log('it works'); 
});
    
});