Hello. There is such code:
$("body").on('dragenter', function(event){ event.preventDefault(); event.stopPropagation(); $(".main_text").html('Отпустите файл'); }); $("body").on('dragleave', function(event){ event.preventDefault(); event.stopPropagation(); $(".main_text").html('Перетащите изображение для загрузки'); }); $("body").on("drop", function(event) { console.log(1); event.preventDefault(); $(".main_text").html('Начало загрузки...'); var file = event.dataTransfer.files[0]; $(".main_text").html(file.name); });
The first two events work, and the drop event simply opens the file, instead of displaying its name. Tell me what am I doing wrong?