SO - 18198927

by Arun P Johny

HTML

<div>switch me</div>

JavaScript

$edit = "<div>edit</div>";
$(document).ready(function () {
    $(document).on('click', 'div', function () {
        $(this).after($edit);
        $edit = $(this);
        $(this).remove();
    });
});