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

274
Views
¿Cómo evitar la "deselección" del texto seleccionado en un área de texto al hacer clic fuera de él?

Hola,

Tengo un área de texto normal como esta:

 <textarea id="usermsg"></textarea>

Quiero poder seleccionar texto dentro de él y luego hacer clic en un botón en algún lugar de la página para realizar una función con esa selección, pero el texto se anula cuando hago clic fuera del área de texto. ¿Alguna forma de prevenir eso?

probé esto

 //clicking the 'test' element will not deselect text. var test = document.getElementById("usermsg"); test.onmousedown = function(e){ e = e || window.click; e.preventDefault(); }

pero sin uso. Este es el violín: https://jsfiddle.net/5zg1v2f6/

Gracias.

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!