title: Get value from input text in same row in table
body: <p>I've got this table with multiple rows. Each row contains 2 text input type fields and a button that runs a function on click. </p>
  
  <p>Basically all of the input fields and buttons have the same id as they are appended with jQuery. Now I only want to pass the values of the text fields that are on the same row as the button. Does anybody now how I can do this?</p>
  
  <pre><code> $("#teams").find('tbody')
          .append($('&lt;tr&gt;')
  
              .append($('&lt;td&gt;')
                  .text(thisarray.matchId)
                  .prop('id','matchId')
              )
  
              .append($('&lt;td&gt;')
                  .text(thisarray.homeTeam)
              )
              .append($('&lt;td&gt;')
                  .text(thisarray.awayTeam)
              )
              .append($('&lt;td&gt;')
                  .append($('&lt;input&gt;')
                      .prop('type', 'text')
                      .prop('id', 'scoreHome')
                  )
              )
              .append($('&lt;td&gt;')
                  .append($('&lt;input&gt;')
                      .prop('type', 'text')
                      .prop('id', 'scoreAway')
                  )
              )
              .append($('&lt;td&gt;')
                  .append($('&lt;input type="button" value="Ok" id="sendGoals"/&gt;')
                  )
              )
          );
  </code></pre>
  
  <p>This is the JS in one file.</p>
  
  <pre><code>function sendAllScores(){
  //get scores
  var scoreHomeTeam = $('#scoreHome').closest('tr').val();
  var scoreAwayTeam = $('#scoreAway').closest('tr').val();
  var matchId = $('#matchId').closest('tr').val();
  </code></pre>
  
  <p>And this from the other file</p>