The .clone() method can take an argument -- true -- that will copy the
events as well.
So, you can do $(this).clone(true) instead of $(this).clone().
There are other ways to achieve this as well, noted in the Frequently
Asked Questions:
http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Apr 29, 2008, at 6:35 PM, Morgan Allen wrote:
Just add the .click to the .clone() chain.
On Tue, Apr 29, 2008 at 2:19 PM, Matt Henry <[EMAIL PROTECTED]>
wrote:
I'm wondering if it's possible to use jQuery to manipulate content
that has been generated by jQuery after the page has loaded.
Here's what I'm trying to accomplish: The user clicks a span in a long
block of text, and that span is cloned, wrapped in list tags, and
appended to a ul at the end of the document:
//Add span to confirmation div at end of document
$('span.data').click(function(){
var confirmList = $('div#confirmSelections ul');
$
(this
).clone().appendTo(confirmList).removeClass("highlight").wrap("<li></
li>");
})
So far, so good. However, I'd like the user to also be able to click
one of the cloned spans at the end and have that remove it from the
list, which I figured ought to look something like this:
//Hide span when clicked
$('div#confirmSelections ul li span.data').click(function(){
$(this).hide();
});
//FAIL
I've had no trouble manipulating the elements that are there at $
(document).ready (e.g. the ul and the div containing it), but I can't
do anything with the lis or spans that are generated by jQuery. What
am I missing?
Any help with this would be greatly appreciated. Thanks.
--
http://morglog.alleycatracing.com
Lets make up more accronyms!
http://www.alleycatracing.com
LTABOTIIOFR! ROFL! ROFL! ROFL!
Upcoming alley cats, reviews, touring logs, and a general
congregation of bike nerdity.