$('.edit').click(function () {
var id = $(this).attr('id');
var text = $(this).parent().text();
$(this).parent().replaceWith("<br><span class='form'><input class='text' type='text' value=" + text + "><input class='submit' type=submit value='Изменить'></span>").trigger("focus");
$('.submit').click(function () {
var val = $(this).siblings(".text").val();
$(this).siblings(".text").remove();
$(this).replaceWith("<p style='margin: -5px 0px -2px 0px'><a target='_blank' href='thread.php?thread=" + id + "'>" + val + "</a><img style='margin-left: 10px; width: 16px; height: 16px' class='edit' id=" + id + " src='../../pics/Edit.png'></p>");
});
});
JCgnLmVkaXQnKS5jbGljayhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBpZCA9ICQodGhpcykuYXR0cignaWQnKTsKICAgICAgICAgICAgdmFyIHRleHQgPSAkKHRoaXMpLnBhcmVudCgpLnRleHQoKTsKICAgICAgICAgICAgJCh0aGlzKS5wYXJlbnQoKS5yZXBsYWNlV2l0aCgiPGJyPjxzcGFuIGNsYXNzPSdmb3JtJz48aW5wdXQgY2xhc3M9J3RleHQnIHR5cGU9J3RleHQnIHZhbHVlPSIgKyB0ZXh0ICsgIj48aW5wdXQgY2xhc3M9J3N1Ym1pdCcgdHlwZT1zdWJtaXQgdmFsdWU9J9CY0LfQvNC10L3QuNGC0YwnPjwvc3Bhbj4iKS50cmlnZ2VyKCJmb2N1cyIpOwogICAgICAgICAgICAkKCcuc3VibWl0JykuY2xpY2soZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbCA9ICQodGhpcykuc2libGluZ3MoIi50ZXh0IikudmFsKCk7CiAgICAgICAgICAgICAgICAkKHRoaXMpLnNpYmxpbmdzKCIudGV4dCIpLnJlbW92ZSgpOwoKICAgICAgICAgICAgICAgICQodGhpcykucmVwbGFjZVdpdGgoIjxwIHN0eWxlPSdtYXJnaW46IC01cHggMHB4IC0ycHggMHB4Jz48YSB0YXJnZXQ9J19ibGFuaycgaHJlZj0ndGhyZWFkLnBocD90aHJlYWQ9IiArIGlkICsgIic+IiArIHZhbCArICI8L2E+PGltZyBzdHlsZT0nbWFyZ2luLWxlZnQ6IDEwcHg7IHdpZHRoOiAxNnB4OyBoZWlnaHQ6IDE2cHgnIGNsYXNzPSdlZGl0JyBpZD0iICsgaWQgKyAiIHNyYz0nLi4vLi4vcGljcy9FZGl0LnBuZyc+PC9wPiIpOwoKICAgICAgICAgICAgfSk7CiAgICAgICAgfSk7