Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!