Как скрыть родителя tr, если each tr > td:nth-child(5)> div:nth-child(3) содержит в себе строку «[+0]»?

$('tr > td:nth-child(6)> div:nth-child(3)')

5d163b2ad753f804705751.png
<tr>
 <td>Stronglav</td>
 <td></td>
 <td></td>
 <td></td>
 <td>
  <span class="edit" attribute="">0.07</span>
  <div class="date">6/28/19, 3:58 PM</div>
  <div class="date">1 th. [+16]</div>
</td>
 <td>
   <span class="edit" attribute="d_eitd">0.09</span>
   <div class="date">6/28/19, 3:57 PM</div>
   <div class="date">0 th. [+0]</div>
 </td>
<tr>
  • Вопрос задан
  • 285 просмотров
Решения вопроса 1
KodyWiremane
@KodyWiremane
Пони, Debian, LEMP, LAN, любитель
// Задаём $(), связанный с нужной таблицей
// table = $('table...')

function handleEachTr() {
    tr = $(this);
    if (tr.find('td:nth-child(6)> div:nth-child(3):contains("[+0]")').size() !== 0) {
        tr.hide();
    }
}

// ...

table.find('tr').each(handleEachTr);

// компактно (для разового применения)

table.find('tr').each(function () {tr = $(this); if (tr.find('td:nth-child(6)> div:nth-child(3):contains("[+0]")').size()) tr.hide()});

// модно
table.find('tr').each((i, e) => {tr = $(e); tr.find('td:nth-child(6)> div:nth-child(3):contains("[+0]")').size() ? tr.hide() : 0});

// ещё моднее
table.find('tr').each((i, tr) => {$(tr).find('td:nth-child(6)> div:nth-child(3):contains("[+0]")').size() ? $(tr).hide() : 0});
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
joeberetta
@joeberetta Куратор тега JavaScript
Читай: https://epdf.pub/google-for-dummies.html
if(elem.includes('[+0]')
//через jquery найдите tr и задайте display none
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы