I'm trying to use Jquery (with no plugins) to enable an edit in place control. The functionality I would like is this. On click of paragraph, the paragraph will be converted into an editable text area. Once the user clicks out paragraph (loses focus) the text will be saved.
I have the following code below and currently part 1 is working, but when I click in the editable area textarea rows="10" cols="160 gets generated and I can't type. Here is what I have
$("#Para1").click(function () {
var textarea = '<div><textarea rows="10" cols="160">' + $(this).html() + '</textarea>';
$(this).html(textarea);
$("textarea.textarea").focus();
$("textarea.textarea").blur(function () {
var value = $(this).val();
$("#Para1").text(value);
});
I have tried to base my code per the link below, but haven't had success.