Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
drop event is not getting triggered

Edit: It works for html elements but not for files!

Here's the code I have:

<!DOCTYPE html>
<html>
  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
    }

    body {
      display: flex;
      align-items: center;
      justify-content: center;
    }

    #drop_zone {
      border: 5px solid blue;
      width:  200px;
      height: 100px;
    }
  </style>
  <script>
    function dropHandler(ev) {
      console.log('File(s) dropped');
    
      // Prevent default behavior (Prevent file from being opened)
      ev.preventDefault();
    

    }
    function dragOverHandler(ev) {
      console.log('File(s) in drop zone');
    
      // Prevent default behavior (Prevent file from being opened)
      ev.preventDefault();
    }
    function dragEnterHandler(ev) {
      console.log('Entered drop zone');
    
      // Prevent default behavior (Prevent file from being opened)
      ev.preventDefault();
    }
    function dragLeaveHandler(ev) {
      console.log('Left drop zone');
    
      // Prevent default behavior (Prevent file from being opened)
      ev.preventDefault();
    }
  </script>
  <body>

    <div id="drop_zone" ondrop="dropHandler(event);" ondragover="dragOverHandler(event);" ondragenter="dragEnterHandler(event);" ondragleave="dragLeaveHandler(event)">
      <p>Drag one or more files to this Drop Zone ...</p>
    </div>
  </body>

</html>

All the other drop events are triggered except for ondrop.

ondrop not getting triggered

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!