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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:19:34+00:00 2026-05-23T08:19:34+00:00

I was trying to improve my web-dev skills for work but got a bit

  • 0

I was trying to improve my web-dev skills for work but got a bit carried away with jQuery’s drag and drop feature. Unfortunately I can’t get the “drop” or “over” events of the droppable to fire.

I didn’t want to use a jQuery table drag/drop plugin so i have multiple div in a div in a td structures (all generated in $(document).ready). The middle div is to be the droppable and the inner most div is to be the draggable. The generated HTML looks like this:

<td class="vertical">
<div id="droppable3" class="droppable ui-droppable" style="width: 100%; height: 100%;"
over="function () { alert("working!"); }" 
drop="function (event, ui) { 
    debugger;
    var firstDrag = ui.draggable;
    var secondDrag = $(this).childNodes[0];
    var destDrop = $(this);
    var sourceDrop = firstDrag.parent;
    $("#middle").append("first drag:" + firstDrag.id + "\nSecondDrag:" + secondDrag.id
     + "\ndest Drop:" + destDrop.id + "\nsourceDrop:" + sourceDrop.id); }">
        <div id="draggable3" class="draggable ui-draggable" 
        style="width: 100%; height: 100%;">
        </div>
</div>
</td>

and it is exactly the same in other TDs except for the ids.

Now the dragging seems to work fine; i can drag that inner div out and it will revert back if i don’t put it on an appropriate droppable or just stick there if i do but it never triggers the “over” or “drop” events. The debugger line in that code is never hit.

Here is how i’m setting up the draggable/droppable:

function getTD(claz){
var td = jQuery("<td/>",{'class': claz});
var droppable = jQuery("<div/>",{
    'class': 'droppable',
    width: '100%',
    height:'100%',
    id: "droppable"+ids[index],
    over: function() {
        alert('working!');
    },
    drop: function(event,ui){
        debugger;
        var firstDrag = ui.draggable;
        var secondDrag = $(this).childNodes[0];
        var destDrop = $(this);
        var sourceDrop = firstDrag.parent;
        $("#middle").append("first drag:"+firstDrag.id +"\nSecondDrag:"+secondDrag.id
            +"\ndest Drop:"+destDrop.id +"\nsourceDrop:"+sourceDrop.id);

        }
    });
    var draggable = jQuery("<div/>",{
        'class': 'draggable',
        width: '100%',
        height:'100%',
        id: "draggable"+ids[index], 
    });

    draggable.draggable({
        revert: 'invalid'
    });
    droppable.droppable({
        accept: ".draggable"
    });
    index++;
    droppable.append(draggable);
    td.append(droppable);
    return td;

}

Basically what i am trying to achieve is swappable tiles in a table and i’m pretty sure the js in the event handler is rubbish but we’ll deal with that once it’s firing.

Oh and im using:
https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js

Any comments would be appreciated.
Thanks 🙂

EDIT:

I was being really stupid. I was putting the “drop” and “over” events in the attributes of the element, not the options of the droppable!

  • 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-23T08:19:34+00:00Added an answer on May 23, 2026 at 8:19 am

    Is that what you wanted?

    Note that you should create a droppable with callbacks like this

    $("#something").droppable({
        drop: function(event, ui) {
            // action
        },
        over: function() {
            // action
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to improve my web development skills. I'm already familiar enough with HTTP,
I'm trying to improve the search functionality on my web forums. I've got a
I am trying to improve the performance of a web application. I have metrics
I'm trying to improve the performance of my web app where a page does
Im trying to improve the Java Html Document a little but i'm running into
I'm trying to improve performance in our app. I've got performance information in the
I'm trying to improve performance in a torrent tracker site . But I've been
We are currently trying to improve our usability in our intranet web app. One
I'm trying to improve the user perception of page load time of some web
I'm trying to improve the performance of a (virtual) web server with a fairly

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.