title: Get selected option ID from populated list
body: <p>I have a radiobutton list that is populated from MySQL. A function to be called when the selected radiobutton changes. I would like to be get the ID of the selected item.</p>
  
  <pre><code> &lt;ul id="radio" class="input-list"&gt;
  &lt;?php
  $stmt = mysqli_prepare($link, "SELECT id, name, price FROM cases ORDER BY price");
  $stmt-&gt;execute();
  $stmt-&gt;bind_result($case_id, $case_name, $case_price);
  while($stmt-&gt;fetch()) {
  echo '&lt;li&gt;
  &lt;input class="selectedoptions" id="'.$case_id.'" name="config-case" value="'.$case_price.'" type="radio" onchange="updateImage(this.id);"&gt;
  &lt;label class="sub-label" for="'.$case_id.'"&gt;'.$case_name.'         [£'.$case_price.']&lt;/label&gt;
  &lt;/li&gt;';
  }
  $stmt-&gt;close();
  &gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>&lt;script&gt;
  
      function updateImage(caseid) {
  
          var selectmenuID = document.getElementById(caseid);
          console.log(selectmenuID);
      }
  
  &lt;script&gt;
  </code></pre>
  
  <p>Attempting to get the id of the selected item is not successful. This is the console output:</p>
  
  <pre><code>&lt;input class="selectedoptions" id="32" name="config-case" value="24"
  type="radio" onchange="updateImage(this.id);"&gt;
  </code></pre>
  
  <p>I would like to get the 32 (the id). How can I do this? Thank you,</p>