-2

Есть таблица типа:

<table class="test" id="kwit_main"
<thead>...</thead>
<tbody>
<tr class="str">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
<tr class="str">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
<tr class="focus">...</tr>
</tbody>
</table>

Как после первого str вставить еще одну строку?

0

1 ответ 1

1
$('.str').first().after('<tr>...</tr>');

$('.str').first().after('<tr><td>NEW</td></tr>');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
  <tbody>
    <tr class="str"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
    <tr class="str"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
    <tr class="focus"><td>...</td></tr>
  </tbody>
</table>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.