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

  • Home
  • SEARCH
  • 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 8959621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:29:09+00:00 2026-06-15T15:29:09+00:00

beforecopy event is fired, but beforepaste event isn’t fired. Why is that? <!DOCTYPE HTML>

  • 0

beforecopy event is fired, but beforepaste event isn’t fired. Why is that?

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">#editor{width:300px; height:300px; border: 1px solid black;}</style>
</head>
<body>
<div id="editor" contentEditable="true">editor</div>
<script type="text/javascript">
var elEditor = document.getElementById("editor");

elEditor.addEventListener('beforecopy', function(e){
    console.log('beforecopy');
    e.preventDefault();
    e.stopPropagation();
}); 

elEditor.addEventListener('copy', function(e){
    console.log('copy');
}); 

elEditor.addEventListener('beforepaste', function(e){
    console.log('beforepaste');
    e.preventDefault();
    e.stopPropagation();
}); 

elEditor.addEventListener('paste', function(e){
    console.log('paste')
});
</script>
</body>
</html>
  • Using the Pasteboard From JavaScript
  • fiddle link : http://jsfiddle.net/BjR9q/
  • 1 1 Answer
  • 0 Views
  • 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-06-15T15:29:10+00:00Added an answer on June 15, 2026 at 3:29 pm

    On Chrome 23.0.1271.95 on OS X 10.8.2, onbeforepaste only triggers when the user causes a context menu to pop up.

    http://help.dottoro.com/ljxqbxkf.php:

    Occurs before the contents of the clipboard are pasted into the document and provides a possibility to enable the Paste menu item.

    Right-clicking the text-box causes the onbeforepaste event to fire, but not pressing ctrl–v.

    If it’s any consolation, the onpaste event fires before the text is actually pasted, in my tests, so I would just use the onpaste event instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

document.getElementById('container').addEventListener('copy',beforecopy,false ); In Chrome / Safari, the above will run the "beforecopy" function when
Before copy on write (COW) , when it says that the parent and child
I don't like questions with debug sessions and memory pointers pasted, but I am
I have a method that copies one stream into another. It's fairly simple and
Is it possible that we can know the free space of any drive through
If you go to the Google Chrome developer tools then Scripts > Event Listener
I have set up links that when clicked I want it to copy the
I have a custom function that looks up the current number of likes for
I have a background worker running to copy a huge file (several GBs) and
Basically in the code below, my final array does not seem to have the

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.