title: Javascript help, tables and radio buttons
body: <p>I am new to Javascript and need some help.</p>
  
  <p>See the image first:</p>
  
  <p><img src="https://i.stack.imgur.com/6aPSS.jpg" alt="here&#39;s a link">.</p>
  
  <p>Points predictor application.</p>
  
  <p>Basically when the user selects the winning team through the radio button
  it should add 10 points to the winning team in the points column and 
  and sort the table (row sorting)automatically based on the points the team has higher points higher position.</p>
  
  <p>Does anyone have any ideas how to achieve this?</p>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;div&gt;
  &lt;table id="pointsTable" border="1" cellspacing="0" cellpadding="5"&gt;
    &lt;tr&gt;
      &lt;th scope="col"&gt;name&lt;/th&gt;
      &lt;th scope="col"&gt;played&lt;/th&gt;
      &lt;th scope="col"&gt;won&lt;/th&gt;
      &lt;th scope="col"&gt;lost&lt;/th&gt;
      &lt;th scope="col"&gt;points&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr id="teamA"&gt;
      &lt;td&gt;team A&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td id="teamApoints"&gt;20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr id="teamB"&gt;
      &lt;td&gt;team B&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td id="teamBpoints"&gt;20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr id="teamC"&gt;
      &lt;td&gt;team C&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td id="teamCpoints"&gt;10&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr id="teamD"&gt;
      &lt;td&gt;team D&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0;&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td id="teamDpoints"&gt;0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;form&gt;
  team A vs team C &lt;br/&gt;
  team A &lt;input type="radio" name="winner" value="teamA" /&gt; 
  team C &lt;input type="radio" name="winner" value="teamC" /&gt;
  &lt;br/&gt;
  &lt;br/&gt;
  team B vs team D &lt;br/&gt;
  team B &lt;input type="radio" name="winner" value="teamB" /&gt; 
  team D &lt;input type="radio" name="winner" value="teamD" /&gt;
  &lt;br/&gt;
  &lt;br/&gt;
  team A vs team D &lt;br/&gt;
  team A &lt;input type="radio" name="winner" value="teamA" /&gt; 
  team D &lt;input type="radio" name="winner" value="teamD" /&gt;
  &lt;br/&gt;
  &lt;br/&gt;
  team B vs team C &lt;br/&gt;
  team B &lt;input type="radio" name="winner" value="teamB" /&gt; 
  team C &lt;input type="radio" name="winner" value="teamC" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;  
  </code></pre>