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

191
Visualizações
how can I implement copy css selector as like chrome using JQuery to take screenshot of particular div

I am letting user to take screenshot on div user clicking on from url, but how can I get css selector Ex.(#clients > div > div > div:nth-child(1)) to capture the screenshot. chrome copy selector


using jquery how can I achieve that, please help me with that.

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

0

I got the answer fot this using library which generates CSS selectors from DOM nodes jhartikainen/dompath and it easy to implement.
Just add dompath.js script into your file.
USAGE :

e.target.contentDocument.body.addEventListener('click', e => {
    targetSelector= '';

    //call function, pass any element:
    var csspath = dompath(e.target);

    //get CSS selector:
    targetSelector = csspath.toCSS();
    console.log(targetSelector);
    //#about > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > ul:nth-child(2) > li:nth-child(1)
});
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