title: How to select tr sibling and input on table
body: <p>I try select and get price after select product and return price on the respect input sibling tr.</p>
  <p>I try</p>
  <pre><code>function getPrice() {
    $(this).closest('tr').find('input').val($(this).val());
  };
  </code></pre>
  <p>and variations with <code>nth-child()</code> but I can not.</p>
  <p>I need update price value</p>
  <pre><code>&lt;!-- Django template tags --&gt;
  {% for item in items %}
  &lt;tr&gt;
    &lt;td&gt;
      &lt;select name=&quot;product&quot; class=&quot;form-control&quot; onchange=&quot;getPrice()&quot;&gt;
        &lt;!-- Django template tags --&gt;
        {% for product in products %}
          &lt;option value=&quot;{{product.pk}}&quot;&gt;{{ product.title }}&lt;/option&gt;
        {% endfor %}
      &lt;/select&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input name=&quot;price&quot; class=&quot;form-control price&quot; type=&quot;number&quot; step=&quot;0.01&quot;&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input name=&quot;quantity&quot; class=&quot;form-control&quot; type=&quot;number&quot; step=&quot;0.01&quot;&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;span class=&quot;span-is-link no&quot; onclick=&quot;removeRow()&quot;&gt;
        &lt;i class=&quot;fa fa-close&quot;&gt;&lt;/i&gt;
      &lt;/span&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  {% endfor %}
  
  &lt;script&gt;
    function getPrice() {
      // Initial test with get value of select.
      // jQuery
      // inpuy in equivalent line of tr
      $(this).closest('tr').find('input').val($(this).val());
    }
  &lt;/script&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/iKnb5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iKnb5.png" alt="enter image description here" /></a></p>