Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 721921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:55:45+00:00 2026-05-14T05:55:45+00:00

There is a common feature of modern browsers where a user can select some

  • 0

There is a common feature of modern browsers where a user can select some text and drag it to an input field. Within the same field it causes moving of text, between different fields it does copying.
How do I disable that? If there is no portable way, I am mostly interested in firefox. This is an intranet webapp, so I am also interested in modifying the browser/getting a plugin to do this. Maybe some system-level settings (I`m on windows XP)?

I need to keep the default select-copy-paste functionality.

The background is I have multiple-field data entry forms, and users often drag something by mistake.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:55:45+00:00Added an answer on May 14, 2026 at 5:55 am

    This code will work in all versions of Mozilla and IE.

    function preventDrag(event)
    {
     if(event.type=='dragenter' || event.type=='dragover' || //if drag over event -- allows for drop event to be captured, in case default for this is to not allow drag over target
        event.type=='drop') //prevent text dragging -- IE and new Mozilla (like Firefox 3.5+)
     {
      if(event.stopPropagation) //(Mozilla)
      {
       event.preventDefault();
       event.stopPropagation(); //prevent drag operation from bubbling up and causing text to be modified on old Mozilla (before Firefox 3.5, which doesn't have drop event -- this avoids having to capture old dragdrop event)
      }
      return false; //(IE)
     }
    }
    
    //attach event listeners after page has loaded
    window.onload=function()
    {
     var myTextInput = document.getElementById('textInput'); //target any DOM element here
    
     if(myTextInput.addEventListener) //(Mozilla)
     {
      myTextInput.addEventListener('dragenter', handleEvents, true); //precursor for drop event
      myTextInput.addEventListener('dragover', handleEvents, true); //precursor for drop event
      myTextInput.addEventListener('drop', preventDrag, true);
     }
     else if (myTextInput.attachEvent) //(IE)
     {
      myTextInput.attachEvent('ondragenter', preventDrag);
      myTextInput.attachEvent('ondragover', preventDrag);
      myTextInput.attachEvent('ondrop', preventDrag);
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a common method/api to list all web browsers (name, executable, default yes/no)
Are there alternatives to PHP that perform faster and have somewhat the same feature
There has been some controversy regarding the practice of doing the following: a, input,
I tried to google common info about subject, but i really can't find some
Is there a common conversion function to convert a integer type object to a
Are there any Common Lisp implementations for .Net?
Is there a common way to get the current time in or with milliseconds?
Is there a common standard for reporting errors in your class functions? I've seen
Is there a common interface in Python that I could derive from to modify
Is there a common way of counting source lines of code (SLOC) in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.