How can I detect or trigger an event when text in <p> tag is changed?

I want to trigger an event when text inside a <p> tag has changed. I thought to use change() but I realize it’s meant for form input elements.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
  <p> Hello </p>
</div>
<button id="click">click to change</button>
$("#click").click(function() {
  $('p').html("done");
});

What triggers the <p> text to change? Maybe put the event you want in those other triggers?

take a look at this post and see if it can solve your issue.