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

126
Views
¿Modificar la selección del usuario en el evento de clic en un elemento <a>?

Cuando hago clic en el texto en el elemento div, puedo modificar la selección. Sin embargo, esto no es posible con un elemento de enlace. ¿Hay alguna manera de que pueda hacer que esto funcione sin modificar el html?

 document.addEventListener('click', click, true) function click(e) { e.preventDefault() } setInterval(() => { let selection = window.getSelection(); selection.modify('extend', 'forward', "documentboundary"); }, 100);
 <div>text in div tag</div> <a href="">text in a tag</a>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿Esto funciona?

 document.addEventListener('click', click, true) function click(e) { e.preventDefault() } setInterval(() => { let selection = window.getSelection(); selection.modify('extend', 'forward', "documentboundary"); }, 100);
 a { user-select: text; }
 <div>text in div tag</div> <a href="">text in a tag</a>

about 4 years ago · Juan Pablo Isaza 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!