Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda