I wanted when i click the button it should turn into text and clone new button.After clone object executed. Function is not working. Here is my code
jQuery
$('button').on('click', function(){
$(this).replaceWith('<p>'+ $(this).text() +'</p>');
$(this).clone().appendTo('body');
});
HTML
<button>1</button>
<button>2</button>
<button>3</button>