Hi,
Just got back to work, and got the snippet below
-----xhtml
<div id="fileqa_submit">
<div class="fileset">
<div><label>File</label><input size="96"
type="file"/></div>
<div><label>Description</label><textarea></textarea></div>
<a href="javascript:;" style="" class="cloneMe">Clone
me</a>
</div>
</div>
-----jquery
// clone this file upload section
$('.cloneMe').click(function(){
$(this).parent().clone().appendTo('#fileqa_submit').slideDown('slow');
});
At the beginning you'd have one section $('.fileset') so when you click
on $(.cloneMe) it clones whole $(' div.fileset') and appends it at the
end of '#fileqa_submit'.
The problem is $(.cloneMe) event on the original is not cloned together.
In other words aim here is to let cloned objects to be able to clone
themselves.
Cheers,
K
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Methvin
Sent: Friday, 27 October 2006 2:02 AM
To: 'jQuery Discussion.'
Subject: Re: [jQuery] Events are not cloned together with the object
> trying to duplicate specific div that has id=someID and within
> that div#someID there is an event attached which is not being
> copied across.
When you clone the div, do you change the cloned ID before inserting so
it
won't create a duplicate ID?
The W3C doesn't whether cloneNode is supposed to clone events or not.
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
Firefox doesn't even clone the checked state of buttons or the current
text
of a text box, so it may not clone dynamically attached event handlers
either. Maybe it would if the handler was attached as an initial
attribute?
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/