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

103
Views
jquery cuenta 2 valores en la tabla ..?

quiero contar el valor en mi tabla y poner el resultado en un div dentro de mi documento Html.

Lo que tengo es el siguiente código:

 var counter = 0; $(document).ready(function(){ $('Table td').each(function(){ if ($(this).text() === "Nicht aktiv") counter++; $("#log2").html("Nicht in Arbeit " + counter); }); });

Quiero comprobar:

si este texto === "Nicht aktiv" y si este texto en otro td es Test1

Jquery o Javascript no son mis idiomas principales, así que no sé cómo puedo resolver esto.

Espero que puedan ayudarme.. :)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

probablemente te refieres

 $(function() { const counter = $('table td') .filter(function() { return $(this).text() === "Nicht aktiv" && $(this).siblings().filter(function() { return $(this).text() === "Test1" }).length > 0; }).length $("#log2").html("Nicht in Arbeit " + counter); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <span id="log2"></span> <table> <tr> <td>Nicht aktiv</td> <td>Bla</td> <td>Test1</td> </tr> <tr> <td>Nicht aktiv</td> <td>Bla</td> <td>Test2</td> </tr> <tr> <td>Nicht aktiv</td> <td>Bla</td> <td>Test1</td> </tr> <tr> <td>Nicht aktiv</td> <td>Bla</td> <td>Test2</td> </tr> <tr> <td>Nicht aktiv</td> <td>Bla</td> <td>Test1</td> </tr> </table>

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!