title: For each input if they are changed to checked store input ID of checked input in variable
body: <p>I would like to store the ID of the input that is currently checked in variable selectedLevelId.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("[id^=level_]").each(function() {
   $(this).change(function() {
            if ($(this).is(':checked')) {
            var selectedLevelId = $(this).prop('id');
            }
  });
   });
  document.getElementById('levelVal').innerHTML=selectedLevelId;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input id="level_4432" name="level_id" type="radio" value="4432"&gt;
  &lt;input id="level_4235" name="level_id" type="radio" value="4235"&gt;
  &lt;input id="level_1454" name="level_id" type="radio" value="1454"&gt;
  &lt;input id="level_9823" name="level_id" type="radio" value="9823"&gt;
  
  &lt;div id="levelVal"&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>