title: Jquery Radio button value not changing
body: <p>Need some help, ive searched google and have no luck.</p>
  
  <p>I am trying to update my radios-button's value in the div class "size-number". That value I want use it within the ajax request below. When i inspect element, the radio-button has the updated value of the button available but when i console.log it in jquery, it gives me the same initial value, despite which i pick. Ive tried setting the radio-buttons to checked="checked". Also i believe its a matter of the default value. Ive also tried input validation within jquery. In addition, ive attempted to reference the input ("input[name='radiobten']:checked") in jquery as well. any suggestions would very appreciated!</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>$(".size-number").click(function(){
    
    var modelid = $("#modelval").attr('value');
    console.log(modelid);
   
    $.ajax({
      url: '"Example API"',
      data:  [],
      dataType: 'json',
      type: "GET",
      success: function(res){
        var newarr = (res).filter(function(indx){
          return indx.model_cat_id == modelid
        });
        console.log(newarr)
        $('modelselect').slideToggle(200).html(res);
      }});
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php foreach ($brands as $brand){ ?&gt;
      &lt;div class="search-select"&gt;
          &lt;i class="fas fa-chevron-down"&gt;&lt;/i&gt;
          &lt;a href="/&lt;?php echo $brand-&gt;full_slug.$urlSize; ?&gt;"&gt;
          
          &lt;?php echo $brand-&gt;name; ?&gt;&lt;/a&gt;
          
      &lt;/div&gt;
      &lt;?php
          $slugCurrent = $brand-&gt;slug;
          foreach ($models as $model){
              if($model-&gt;brand_id == $brand-&gt;id){
              if(is_null($model-&gt;model_cat_id)){?&gt;
                  &lt;div class="size-number" style="display: none;"&gt;
                      &lt;a href="/&lt;?php echo $brand-&gt;slug; ?&gt;/&lt;?php echo $model-&gt;slug_full.$urlSize; ?&gt;" style="color: blue;"&gt;&lt;?php echo $model-&gt;name; ?&gt;&lt;input type="radio" id="modelval" name="radiobten" value="&lt;?php echo $model-&gt;id?&gt;"/&gt;&lt;/a&gt;
                  &lt;/div&gt;
  
                  &lt;?php    
              }
                  
              }
          }
      }?&gt;</code></pre>
  </div>
  </div>
  </p>