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

109
Visualizações
jQuery to delete hide table row if based on contents of two cells within row

I'm trying to write a script for tampermonkey that hides a row in a table based on two conditions.

Condition 1: The cell in column 3 doesn't contain '/'

Condition 2: the cell in column 3 does contain '0:0'

I've got condition 1 working on its own with the following jQuery

$("td:nth-of-type(3):not(:contains('/'))").parent ().hide ();

and condition 2 with

$("td:nth-of-type(3):contains('0:0')").parent ().hide ();

but I haven't been able to combine them, I've tried the following:

$("[td:nth-of-type(3):contains('0:0')][td:nth-of-type(3):not(:contains('/'))]").parent ().hide ();

but no luck. How can I combine the conditions? I've tried to include an if statement but haven't been able to get that working either.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You were heading in the right direction. Keep chaining the :contains and :not(:contains(...)) calls.

Try the runnable example below, note that the 1st and 4th rows are hidden.

$("td:nth-of-type(3):contains('0:0'):not(:contains('/'))").parent().hide();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table border="1">
<tr>
  <td>&nbsp;</td><td>&nbsp;</td>
  <td> 0:0 </td><td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td><td>&nbsp;</td>
  <td>123//</td><td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td><td>&nbsp;</td>
  <td>/ 0:0</td><td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td><td>&nbsp;</td>
  <td>0:0</td><td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td><td>&nbsp;</td>
  <td>0:0/</td><td>&nbsp;</td>
</tr>
</table>

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