Change from hidden to textbox. What's wrong in my code?
<p>I have a form with some fields of type text and 2 fields (name and second name) that have a value by default, and these 2 fields are of type="hidden".</p>

<p>Now, I would like to add a link on the form "Fill an order for another person". If the user click on this link the fields name and second name must be of type text to allow the user enter a name/second name. I tried to use jQuery to remove the existing hidden field, and create a new textbox in it's place, with the same value as the hidden one. </p>

<p>Here is an example of what I want: <a href="http://jsfiddle.net/FT2B3/1/" rel="nofollow">http://jsfiddle.net/FT2B3/1/</a></p>

<p>Can you tell me whats wrong? Thanks in advance.</p>

<pre><code>(...)
if ($field_label=="First name")
{
return sprintf("&lt;div class='ginput_container'&gt;$fname&lt;input name='n1' id='$fname1' type='hidden' value='$fname' class='ginput_container/&gt;&lt;/div&gt;");

?&gt;
   &lt;script type="text/javascript"&gt;

   $(function(){

        $('#nform').click(function() 
    {

    $nbox1 = $("&lt;div class='ginput_container'&gt;&lt;input id='$fn1' type='text' class='ginput_container'/&gt;&lt;/div&gt;").val($('#fname1').val());

           $('#fname1').after($nbox1).remove();

    });
});
&lt;/script&gt;
&lt;a href="#" id="nform"&gt;Link&lt;/a&gt;
&lt;?php
}
(...)
</code></pre>
