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

  • Home
  • SEARCH
  • 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 9148689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:20:35+00:00 2026-06-17T11:20:35+00:00

http://jsbin.com/ituxij/4/edit I am trying to drag and drop images into div’s with Jquery I

  • 0

http://jsbin.com/ituxij/4/edit

I am trying to drag and drop images into div’s with Jquery I have a function

<div id="trash" class=""> Trash</div>

$trash.droppable({
    accept: "#gallery > li",
    activeClass: "ui-state-highlight",
    drop: function(event, ui) {
        var $droppableId = $(this).attr("id");

        deleteImage($droppableId, ui.draggable);
    }
});

In this case $droppableId = trash or the name of my div.

I’m calling

function deleteImage($droppableId, $item) {
    $item.fadeOut(function() {
        alert($droppableId);
        var $list = $("ul", $droppableId).length ? $("ul", $droppableId) : $("<ul class='gallery ui-helper-reset'/>").appendTo($droppableId);

        $item.find("a.ui-icon-trash").remove();
        $item.append(recycle_icon).appendTo($list).fadeIn(function() {
            $item.animate({
                width: "48px"
            }).find("img").animate({
                height: "36px"
            });
        });
    });
}

The function alerts out trash, which is correct, but when I try to pass “trash” into the .appendTo method it does not work the same as if I simple typed out trash.

  • 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-06-17T11:20:37+00:00Added an answer on June 17, 2026 at 11:20 am

    $droppableId is simply the id of the element not a selector or the element itself.

    Try .appendTo($('#'+$droppableId)); or .appendTo('#'+$droppableId);

    As a side point I’d try and refrain from using $ at the start of your variables when using jquery, it can look a little confusing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsbin.com/uxepap/3/edit Here is div with links inside. I'm trying to replace comma inside last
I made some sample of jQuery Dragging http://jsbin.com/ehuke4/6/edit Its all ok when i drag
http://jsbin.com/ifoguf/14/edit#javascript I attempted Isolating the Inheritance Part into a Function, but when I create
page: http://jsbin.com/eniva4/edit I have one main div: #main-content which contains two div's : #announcement
EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
Edit: I put this snippet of code in jsbin: http://jsbin.com/eneru I am trying to
I have this HTML and CSS http://jsbin.com/uciya5/3/edit where the problem is that the radio
Please see my code here http://jsbin.com/ijoxa3/edit var drawHorizondalLine = function(x1,y1,x2,y2, color) { var width
I'm using the code found in this jsbin: http://jsbin.com/asahe5/10/edit There is a function within
http://jsbin.com/uremuc/2/edit If I'm choosing jquery 1.5.2 in jsBin , running .attr('tagName') should return me

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.