replaceWith jquery - chnage tags

by ian_smithz

HTML

<button>First</button>
<button>Second</button>
<button>Third</button>

JavaScript

$( "button" ).click(function() {
  $( this ).replaceWith( "<div>" + $( this ).text() + "</div>" );
});