JSFiddle - React, Tailwind, and code Playground

HTML

<div id="add"><b>click to add paragraph</b></div>

<div id="containerDiv">

<p>Click to hide me</p>

</div>

JavaScript

$(document).ready(function(){
  
$("#add").click(function(){
     $("#containerDiv").append("<p> I should hide as well if you click me </p>");
  });


 $("p").click(function(){
     $(this).hide();
  });


  
});