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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:27:13+00:00 2026-06-02T05:27:13+00:00

Draggable works here, but when I drag the DIV to the droppable area the

  • 0

Draggable works here, but when I drag the DIV to the droppable area the alert function isnt firing. I’m sure it’s something stupid, but maybe someone here can stop me from banging my head on the wall, what am I not doing right?

<head>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
            <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
            <title></title>
        </head>
        <body>

    <script>
            $(function() {
                $( ".draggable" ).draggable();
                $( ".droppable" ).droppable({
                    drop: function(event, ui) {
                        alert('dropped');
                    }
                });
            });
    </script>

        <div id=10 class="draggable">one</div>

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



        </body>
        </html> 
  • 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-02T05:27:16+00:00Added an answer on June 2, 2026 at 5:27 am

    The issue is with the fact that by default the center of the element is used to determine where the element is dropped. Your div does not have a defined size so it is the width of the screen. If you manage to drop it so that the center of this element is in the droppable you will see the alert.

    This fiddle with background colors illustrates the problem.

    http://jsfiddle.net/v6PME/

    And with a defined width you will see the functionality you were probably looking for:

    http://jsfiddle.net/v6PME/1/

    NOTE: I’ve made the assumption that you’ve left out your css and the #trash div has some size so that it can be dropped in at all.

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

Sidebar

Related Questions

$(#b).draggable(); $(#map_canvas).droppable({ drop: function() { //alert('dropped'); aFn(); }
I'm trying to use draggable/droppable in a manner that allows you to drag and
OK, I'm probably missing something obvious here, but my searches aren't turning up anything
I think I'm missing something here. in Script: $('#dialog:ui-dialog').dialog('destroy'); $('#dialog-modal').dialog({ width:150, height:150, resizable:false, draggable:false,
my code is very simple <div id=test></div> $( #test ).resizable().draggable(); the drag effect could
I am building an app utilizing jQuery UI draggable/droppable. I need to drag boxes
I'm using the Draggable/Droppable functionality of Jquery to allow drag-and-drop from a TreeView to
I'm not entirely sure how to post this question, but here goes... I have
I found this function to make my divs draggable and it works fine. right
Basically I have a draggable list which is connected with a sortable list. Works

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.