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

203
Visualizações
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 Respostas
Responde à pergunta

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 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