Problem about dragging and dropping images in jquery
Hello everybody.
I'm trying to create my own drag and drop for images, I thought that I had understood the tutorials that I did but it seems I might not have gotten it. So I was hoping someone here could maybe tell me if I did understand or not.
This is my html code
- <div class="upload-console-drop" id="drop-zone"
- just drag and drop files here
- </div>
This is my js
- $(document).ready(function(){
- var dropZone = document.getElementById('drop-zone');
- dropZone.ondrop = function(e){
- e.preventDefault();
- console.log(e);
- }
- });
So from what I understood is that by doing e.preventDefault() you stop the image from opening up in the tab when you drag it over, but in my case it still opens up.
Am I missing something?
Thank's a lot!