I am listening to the drop
event and doing e.preventDefault()
But its trying to open the dropped file. It was working fine till yesterday. But just today It broke for some unknown reason. I made a JsFiddle#bwquR/10
to reflect the Same.
It looks like if you don't take the dragover
event drop
cannot be handled. even in the the fiddle If you comment the dragover
It will not work.
In the actual work I missed the spelling of dragover
But its still a question drop
will not work without dragover
The fiddle was actually working but s the body was so small (only text DROP
there). It was taking drop
event only on that small area where DROP
text lies not on the entire body. So I thought It was not working. Sorry for the confusion.
In order to have the drop event occur on a div element, you must cancel the ondragenter and ondragover events. Using jquery and your code provided... Show activity on this post.
The dragover event is fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds). The event is fired on the drop target(s).
The drop event is fired when an element or text selection is dropped on a valid drop target.
1 to pull or be pulled with force, esp. along the ground or other surface. 2 tr; often foll by: away or from to persuade to come away (from something attractive or interesting)
I guess it is because that without dragOver event handler, default event handler of dragOver event is used, thus, no drop event is triggered after that. There is a need with e.preventDefault
for dragOver event before drop event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With