Я использую cheerio js
для очистки сайта
console.log($('table tbody tr'))
Над консолью печатаются все объекты. Однако, когда я попытался l oop через элементы, как указано ниже
$('table tbody tr').each(function (index, element) {
}
, я получаю следующую ошибку:
SyntaxError: Unmatched selector: tbody tr
Любой понимание этой ошибки поможет вам
Edit
Ниже приведена структура таблицы, которую я пытаюсь очистить.
<table border="1" cellspacing="1" cellpadding="1" class="table table-striped" style="font-weight:bold">
<thead>
<tr>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
<th><strong>Heading</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>row 1 col 1</td>
<td>row 1 col 2</td>
<td>row 1 col 3</td>
<td>row 1 col 4</td>
<td>row 1 col 5</td>
</tr>
<tr>
<td>row 2 col 1</td>
<td>row 2 col 2</td>
<td>row 2 col 3</td>
<td>row 2 col 4</td>
<td>row 2 col 5</td>
</tr>
</tbody>
</table>