Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6340903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:55:22+00:00 2026-05-24T19:55:22+00:00

I kind of need some help with clone() in jQuery. So, the thing is

  • 0

I kind of need some help with clone() in jQuery.

So, the thing is this: I’m doing some kind of drag&drop&sort that will work on touch devices. Everything is good except that when i clone an element, the events are gone (drag stop working).

The code looks like this (over simplified):

$('li', layers).each(function(){
    this.addEventListener('touchend', function(e){
        var cloned = $(this).clone( true, true ); // no events are cloned at all!
        cloned.insertBefore( this.helper ); 

    }); //ontouchend

    this.addEventListener('touchmove', function(e){
        // do some stuff with this.helper
    });
});

What do i do wrong?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:55:23+00:00Added an answer on May 24, 2026 at 7:55 pm

    Since a DOM element is one thing (and not automatically cloned), using a function like insertBefore will move the element instead of copying it. If you make use of this ‘trick’, you also don’t have trouble with events not being cloned because it’s the very same element with everything bound.

    So you could do e.g.:

    this.addEventListener('touchend', function(e){
        this.insertBefore( this.helper ); 
    }); //ontouchend
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kind of new to this whole thing so I need some help. I
I have a need for some kind of information that is in essence static.
I'm having a hard time wrapping my head around this and need some help
so this is part of my homework assignment. need some help with it. my
So i have a some kind of test and i need some help, I'm
i need some help again! At first i really thought it was some kind
I need some help with jQuery Calendar application. The specific calendar I'm looking for
I would need some help with the following code if you are kind. Basically
I need some help on this problem. It is about ASP.NET MVC3. I have
I need some help with a program that I am writing for my Systems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.