Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
JavaScript - Prevent cut and paste by drag and drop

I want to prevent the following behavior on a contenteditable div, because it messes with the structure if the div contains any other elements but text nodes.

enter image description here

I have tried the obvious:

  1. Setting draggable="false" on the div
  2. Calling preventDefault on the dragstart and drop events (event listeners also on the div)

However, this does not seem to work and I want to allow regular pasting, so disabling that is not an option.

Any help would be much appreciated. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

preventDefault on ondragover should prevent this behaviour.

https://www.w3schools.com/jsref/event_ondragover.asp

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda