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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:06:01+00:00 2026-06-08T03:06:01+00:00

Playing with drag and drop and while I can seem to drag fine, I

  • 0

Playing with drag and drop and while I can seem to drag fine, I can’t seem to drop.

Here’s my playground:
http://jsfiddle.net/KZ8RD/1/

Basically, the dragstart and dragend events on the draggable node seem to fire fine. But I have yet to trigger any event on that target nodes.

# Source handlers
$('#source')
  .on('dragstart', (e) -> log '#source dragstart', this, e)
  .on('dragend',   (e) -> log '#source dragend',   this, e)

# Target Handlers
$('#cells td')
  .on('dragenter', (e) -> log 'target dragenter',  this, e)
  .on('dragleave', (e) -> log 'target dragleave',  this, e)
  .on('dragover',  (e) -> log 'target dragover',   this, e)
  .on('drop',      (e) -> log 'target drop',       this, e)​​​

So what conditions need to exist for the target’s dragenter and drop events to fire? I’m clearly missing some of them.

  • 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-08T03:06:03+00:00Added an answer on June 8, 2026 at 3:06 am

    You’ve been bitten by one of the many quirks of the HTML5 draggable API: You need to attach some data to the drag event, or else it will be ignored by potential drop targets. The fix is to add the line

    e.originalEvent.dataTransfer.setData 'text/html', 'foo'
    

    to the dragstart event. (Note that e.dataTransfer won’t work because the dataTransfer property isn’t copied onto e by jQuery, at least as of 1.7.) Working fork of your playground: http://jsfiddle.net/AK2zJ/

    Note that this will give you dragenter and dragover, but not drop… as the aforementioned article points out:

    For the drop event to fire at all, you have to cancel the defaults of both the dragover and the dragenter event.

    You can do this in jQuery by returning false from each of those events. Here’s an example with that modification as well, allowing the drop event to occur: http://jsfiddle.net/YaEBj/

    In addition to this kludginess, it’s worth mentioning that there are serious flaws in the HTML5 draggable API. Really, the only good reason to use it (instead of something like jQuery UI) is if you want to enable drag-and-drop operations across multiple browser windows.

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

Sidebar

Related Questions

The following is when using the drag and drop library from here: http://code.google.com/p/gwt-dnd/ When
I'm playing with Drag and drop funcitonality for the first time so I'm not
I am playing a little with drag and drop under gtk#. When calling protected
I'm playing around with the drag and drop feature of jQuery UI and it's
I'm playing with file upload, drag and drop, and canvas, but for some reason
I was playing around with drag and drop. I made a sample application and
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
While playing with standard library i've found a strange difference between python2 and python3.
Playing around with customizing the appearance of the Wizard control in ASP.Net, and I've
While playing around with one-to-one associations in castle activerecord I stumbled upon the following

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.