JQuery selection after id

i cannot determine the correct selector for the table.

  <tr id="test1">
  <td></td>
  <td></td>
  </tr>
  <tr>
  <td colspan="2">\*SELECT THIS \*</td>
  </tr>

I want to select tr with id and select the input of the second tr "* SELECT THIS *"

$("#test1").next()

So, I'm in the second tr, but I want td under this tr.

$("#test1").next().$("td") does not work.

Any ideas?

+4
source share
3 answers
$("#test1").next().children('td');

From brother, you need to delve into your children. More concise would be the following:

$('#test1 + tr td');
+5
source

Close! Use.children();

$("#test1").next().children('td');
+3
source

use this

$("#test1").next().find('td');
+1
source

Source: https://habr.com/ru/post/1659547/


All Articles