JSFiddle - React, Tailwind, and code Playground

by Alexander

HTML

<button class="foo">reload</button><br>
<button class="bar">Binded?</button>

JavaScript

$('.foo').click(function () {
	$('.bar').remove();
	$('<button class="bar">Binded?</button>').insertAfter('br');
  $('.bar').bind('click', function(){
  	foobar();
  });
});

$('.bar').on('click', function () {
	foobar();
});

function foobar() {
	alert(1);

}