JSFiddle - React, Tailwind, and code Playground

HTML

<button id="theId" type="button" >Add</button>

JavaScript

let addButton = $('#theId');
addButton.click(() => console.log('foo'));

$.ajax('https://reqres.in/api/users?page=2', {
  success: function(result) {
    console.log('gets here')

    addButton.off('click');
    addButton.click(function () {
      console.log('bar')
    });
    
    addButton.html("aNewName");
  },
})