Your code works fine without the .html(). If you're trying to log what you get, then it will say 'object', which is to be expected.
On Mar 5, 8:18 am, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > Possible work-a-around... > > Enclose your form in a div, say "<div id='form-div'>form...</div>, > and clone the div...? > > Rick > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of bstoppel > Sent: Thursday, March 05, 2009 11:07 AM > To: jQuery (English) > Subject: [jQuery] Re: .clone a form > > Without the .html() part you get an object. With .text() you get what > appears to be HTML entities and text. > > On Mar 5, 6:10 am, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > > Not sure, but it might be that the .html() part is telling the clone > > function to just clone the html *within* .hook:first. > > > What happens if you leave off the .html() part? > > > Rick > > > -----Original Message----- > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] > > O > > > Behalf Of bstoppel > > Sent: Wednesday, March 04, 2009 11:50 PM > > To: jQuery (English) > > Subject: [jQuery] .clone a form > > > Hi All. > > > I am having an issue with cloning a form. When I clone an existing > > form, only the input tags are cloned. Here is an example" > > > -- HTML > > > <form class="hook" action="do/something" method="post" > > enctype="multipart/form-data"> > > <input type="text" name="variable"> > > <input type="submit"> > > </form> > > > <div id="clonehere"></div> > > > -- JQuery > > > $('#clonehere').append($('.hook:first').clone(true).html()); > > > -- Result > > > #clonehere will only get this part of the form <input type="text" > > name="variable"> <input type="submit"> > > > What am I doing wrong?