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

206
Vistas
How to querySelectorAll by className and specific dataset value?

My next question is how I am able to querySelectorAll elements which have a certain className and a dataset attribute assigned to false. The following example works as I want it to.

   const huecosDisponibles = document.querySelectorAll('.huecoDisponible[data-listaespera="false"]');
console.log(huecosDisponibles);
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>
<div class="huecoDisponible" data-listaespera="true">hola</div>
<div class="huecoDisponible" data-listaespera="false">hola</div>

Nevertheless, I am trying to apply the same selection technique after performing an Ajax request in a C# razor page and it doesn't happen. The function which contains the ajax request sets some of the boxes to true or false.

In my case, I have to select the ones that they have the dataset attribute to false. I assume that the problem may lie in the document.ready state. I tried moving my variable after the ajax request is completed and still I am getting the same error again and again:

Uncaught ReferenceError: huecosDisponibles is not defined

     

If anyone has any advice which can help me solve this problem, that would be really grateful.

Thanks in advance

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

document.ready doesn't fire after AJAX completion or anytime when nodes inserted to DOM.

Be sure, that you have appended new nodes to DOM. JS code of AJAX would be helpful.

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