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

330
Visualizações
I have written code to copy the link from box but is it showing me the following error
    copyURL1(){
    const links = document.getElementsByClassName("copylink" );`enter code here`
    const range = document.createRange();
    range.selectNode(links);
    const selection = window.getSelection();
    selection.removeAllRanges();
    selection.addRange(range);
    const successful = document.execCommand('copy');  
  }

I have written the code to copy the text from element but its showing the error Argument of type 'HTMLCollectionOf' is not assignable to parameter of type 'Node'. Type 'HTMLCollectionOf' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 46 more.

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

0

Change getElementsByClassName code, this might help.

const links = document.getElementsByClassName("copylink" ).item(0);

Ref: https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNode

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