Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
Mouse cursor highighted data

I wanna ask how to get strings data when I highlight the text by mouse. For example when I highlight some text on the website. I should get the text copied to my API automatically. I don't have time to copy-paste. I wanna do it automatically copy and paste when I highlight the text. I have basic knowledge of Js and php.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There isn't any onhighlightext event function or anything like that, but a solution would be to bind the onmouseup event to check if any text is selected. See example for selecting highlighted text here: On Text Highlight Event?

Another part of your question is the copy to clipboard function. Here is a text copy example function, which works for my use cases:

  <html>
     <head>
     </head>
     <body>
         <button onclick="toClipboard('Some text!')">Copy me</button>
         <script>
         function toClipboard(str) {
             tc = document.createElement('textarea');
             tc.value = str;
             document.body.appendChild(tc);
             tc.select();
             document.execCommand('copy');
             document.body.removeChild(tc);
         };
         </script>
     </body>
 </html>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda