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

174
Views
Jquery/JS previene el menú de clic derecho en los navegadores

Tengo mi div con un menú emergente de clic derecho:

 // Attatch right click event to folder for extra options $('#fBox' + folderID).mousedown(function(event) { if (event.which == 3) { // Set ID currRClickFolder = folderID; // Calculate position to show popup menu var height = $('#folderRClickMenu').height(); var width = $('#folderRClickMenu').width(); leftVal = event.pageX - (width / 2) + "px"; topVal = event.pageY - (height) + "px"; $('#folderRClickMenu').css({ left: leftVal, top: topVal }).show(); } });

Pero el navegador de este elemento aún muestra el menú predeterminado (copiar/pegar/propiedades, etc.). ¿Alguna forma de desactivar esto? Intenté devolver falso pero no tuve suerte.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede deshabilitar el clic derecho agregando oncontextmenu="return false;" a la etiqueta de su cuerpo.

 <body oncontextmenu="return false;">
over 4 years ago · Santiago Trujillo Report

0

Puede deshabilitar el menú contextual en cualquier elemento que desee:

 $('selector').contextmenu(function() { return false; });

Para deshabilitar completamente el menú contextual en la página (gracias a Ismail), use lo siguiente:

 $(document).contextmenu(function() { return false; });
over 4 years ago · Santiago Trujillo Report

0

Una línea jQuery:

 $('[id^="fBox"]').on("contextmenu", function(evt) {evt.preventDefault();});
over 4 years ago · Santiago Trujillo Report
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!