$(function() { document.addEventListener('dragenter', function(event) { event.preventDefault(); }); document.addEventListener('dragover', function(event) { event.preventDefault(); }); document.addEventListener('drop', function(event) { if (event.dataTransfer.files && event.dataTransfer.files.length) { event.preventDefault(); loadVideoObject(event.dataTransfer.files[0]) } }); });