JSFiddle - React, Tailwind, and code Playground
by Gerald Gillespie
HTML
<input type="button" class="viewShow" value="this is bound. click to prove it"/>
<input type="button" value="click to unbind it"/>
JavaScript
jQuery.fn.outerHTML = function(s) {
return s
? this.before(s).remove()
: jQuery("<p>").append(this.eq(0).clone()).html();
};
$('.viewShow').on('click', function(){
alert('bound!');
});
$('input:last').on('click',function(){
$newthing = $('.viewShow').clone().wrap('<p>').parent().html();
$('.viewShow').after($newthing).remove();
});