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

167
Vistas
How do I run querySelector backwards?

In a document, there are 2 elements with the class name "div._13NKt.copyable-text.selectable-text". (It's web.whatsapp.com)

One on top of the document, one on the bottom of the document.

I would like to querySelect the 2nd element / the element on the bottom.

How could I do this?

Is there an option to do a querySelect backwards?

Here is my code so far:

document.querySelector("div._13NKt.copyable-text.selectable-text").focus();

I am running this command using mobileFX web brower based on Chromium.

I call it like this:

webkit1.Eval("document.querySelector(" & Quote("div._13NKt.copyable-text.selectable-text") & ").focus();")
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Something like this?

const elements = document.querySelectorAll("div._13NKt.copyable-text.selectable-text");
if(elements.length) elements[elements.length - 1].focus();
about 4 years ago · Juan Pablo Isaza Denunciar

0

I think you can use document.querySelectorAll("div._13NKt.copyable-text.selectable-text") and then access to the index.

//Capture the elements
let myVar = document.querySelectorAll("div._13NKt.copyable-text.selectable-text");

//Then access to the index, taking into account that the initial index is 0.
console.log(myVar[1])
//Or
var secObject = myVar[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