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 1085007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:38:02+00:00 2026-05-16T22:38:02+00:00

My requirements are to: Clone dynamically created image with on_click . Be able to

  • 0

My requirements are to:

  1. Clone dynamically created image with on_click.
  2. Be able to drag that cloned object.
  3. Be able to delete it and capture the position of that image.

After tinkering for a week with ajax controls, now I thought of using jQuery. If you could suggest some article related to this it will help me. I read lot of articles on this website, but couldn’t come to a solution.

I got the below code to work, but I don’t know how to add functionality for resizing:

$(document).ready(function() {
      //Counter

          counter = 0;
          //Make element draggable
          $(".drag").draggable({ 
              helper: 'clone',
              containment: 'frame',

              //When first dragged
              stop: function(ev, ui) {
                  var pos = $(ui.helper).offset();
                  objName = "#clonediv" + counter
                  $(objName).css({ "left": pos.left, "top": pos.top });
                  $(objName).removeClass("drag");


                  //When an existiung object is dragged
                  $(objName).draggable({
                      containment: 'parent',
                      stop: function(ev, ui) {
                          var pos = $(ui.helper).offset();
                          //console.log($(this).attr("id"));
                          //console.log(pos.left)
                          //console.log(pos.top)
                      }
                  });
              }
          });
          //Make the element resizable 


          //Make element droppable
          $("#frame").droppable({ 

              drop: function(ev, ui) {
                  if (ui.helper.attr('id').search(/drag[0-9]/) != -1) {
                      counter++;
                      var element = $(ui.draggable).clone();
                      element.addClass("tempclass");
                      $(this).append(element);
                      $(".tempclass").attr("id", "clonediv" + counter);
                      $("#clonediv" + counter).removeClass("tempclass");

                      //Get the dynamically item id
                      draggedNumber = ui.helper.attr('id').search(/drag([0-9])/)
                      itemDragged = "dragged" + RegExp.$1
                      //console.log(itemDragged)

                      $("#clonediv" + counter).addClass(itemDragged);
                  }
              }
          });
      });

I have some sample code to resize the image, but I couldn’t drop the clone into my frame:

 $(document).ready(function() {
      $("#fff").resizable({ handles: "all", ghost: true, autoHide: true }).parent().draggable({ helper: 'clone', containment: 'frame' });

      });
     ***my Code behind .cs class***
     TableCell newcell = new TableCell();
                    System.Web.UI.WebControls.Image myImage = new System.Web.UI.WebControls.Image();
                    myImage.ID = "imgv" + dt.Rows[datavount]["id"];
                    //myImage.Attributes.Add("alt",  myImage.ID+"fffff");
                    myImage.Width = Unit.Pixel(30);
                    myImage.Height = Unit.Pixel(30);

 Panel newpanel = new Panel();
                    newpanel.ID = "pnl" + myImage.ID;
                    newpanel.BorderStyle = BorderStyle.Outset;
                    newpanel.Controls.Add(myImage);
                    newpanel.Width = Unit.Pixel(50);
                    newpanel.Height = Unit.Pixel(50);
                    newpanel.Attributes.Add("class", "drag");[my jquery function is applied to drag class]
                    newcell.Controls.Add(newpanel);

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-16T22:38:03+00:00Added an answer on May 16, 2026 at 10:38 pm

    It sounds like jQuery UI Draggable is exactly what you’re after. You’d use the helper: 'clone' option for the cloning, like this:

    $("img").draggable({
      helper: "clone"
    });
    

    You can attach whatever behaviors you want with the drop event, for example adding a close button, getting the position, etc, for example:

    $("img").draggable({
      helper: "clone",
      stop: function(e, ui) {
        var top = ui.position.top;   //new left position of cloned/dragged image
        var left = ui.position.left; //new top position of cloned/dragged image
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Requirements: Must be able to use C strings as well as C++ strings Fast
Here are the requirements: Must be alphanumeric, 8-10 characters so that it is user
Premise : The requirements for an upcoming project include the fact that no one
Seems that requirements on safety do not seem to like systems that use AI
My requirements: Support .NET Compact Framework 2.0 and Windows Mobile 6.0 devices. Only need
Some of the requirements (restrictions) for such a ui framework/toolkit are: No single vendor
Given the extremely high requirements for unpredictability to prevent casinos from going bankrupt, what
If the requirements are changing frequently and you want to deliver your code in
How do you go about the requirements gathering phase? Does anyone have a good
What all would be the requirements for the following scenario: A GSM modem connected

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.