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] On
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?

Reply via email to