Last active
December 16, 2015 20:00
-
-
Save ada-lovecraft/5489617 to your computer and use it in GitHub Desktop.
Grab text data from dropped item.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#dropTarget") | |
.bind("dragover", false) | |
.bind("dragenter", function(e) { | |
// add the "activeDrag" class when dragenter is detected | |
$(this).addClass('activeDrag'); | |
}) | |
.bind("drop", function(e) { | |
e.preventDefault(); | |
// grab the text data from the dropped item | |
var dragData = e.originalEvent.dataTransfer.getData("text") || | |
e.originalEvent.dataTransfer.getData("text/plain"); | |
// do something with the data | |
{ ... } | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment