My challenge involves working with a rectangle where I need to drop files. The issue is that when I try to drop them, the browser automatically redirects to the file location. While this behavior is expected, it interferes with my goal of uploading the file effectively.
I have learned that using e.preventDefault() should solve this problem, but unfortunately, it does not seem to be effective in my case.
Below is an excerpt of my code:
<div id="dropHere">
<p>Drop your files here...</p>
</div>
<script>
dropHere.addEventListener("drop", function(e) { e.preventDefault(); });
</script>
Although I omitted certain parts of my code (such as javascript and CSS), I am still facing challenges with why e.preventDefault() is not functioning as intended. Can anyone provide any insight into this issue?