Jquery get <p> html and replace with text box
<p>I have a link, when I click on it, it should select a div p tag contents and replace the p tag with text box and previously stored contents.</p>

<p>Now my code is removing the p tag and adding text box but it is removing text box immediately and inserting p tag. After user presses enter, I want ajax fn to be called.</p>

<p>This is what I tried,</p>

<pre><code>&lt;a href="" id="den"&gt;DEN&lt;/a&gt;
&lt;div id="test"&gt;
&lt;p id="x"&gt;I am doing good&lt;/p&gt;
&lt;/div&gt;
 $("#den").live("click", function () {
       var con = $("#test &gt;p#x").html();
       $("#test &gt; p#x").remove();
       $("#test &gt; p#x").append('&lt;textarea type="text" value='+con+'&gt;&lt;/textarea&gt;');

}); 
        });
</code></pre>
