JSFiddle - React, Tailwind, and code Playground

by rwaldron

HTML

<div id="dropzone"></div>

CSS

#dropzone {
 width:100px;
 height: 100px;  
border:1px solid;
}

JavaScript

$.event.props.push('dataTransfer');

var $drop = $('#dropzone');
    
$drop.bind( 'dragenter dragover', false)
      .bind( 'drop', function( e ) {
        e.stopPropagation();
        e.preventDefault();
        
      //  without $.event.props.push('dataTransfer')
      //  this would error:
      //  cannot access property files of undefined
        
        console.log( e.dataTransfer.files );

      });
});