title: On click radio button uncheck and check my new one
body: <p>Hi i am using JavaScript to change the ticked radio button when the user clicks a new radio button.. now my problem is when i click the new one it hits the function fine but it has already checked the radio button meaning when i try to compare if it has been checked or not it will always come back as true, this means it wont remove the last ticked one and both will always be ticked.</p>
  
  <p>JavaScript:</p>
  
  <pre><code>function Radio(a){
  
              var value = $(a).attr('value');
              var checked = a.checked;
              if (checked)
              {
                  return;
              }
              else if (!checked)
              {
                  $('.RadioClick').prop('checked', false);
                  $(a).attr('checked', true);
  
              }
  
          }
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;input  onclick="Radio(this)" class="RadioClick" type="radio" value="1" checked&gt;
  &lt;input onclick="Radio(this)" class="RadioClick" type="radio" value="2" &gt;
  </code></pre>
  
  <p>Any help would be good? It needs to be a onclick for some factors so please only suggest ideas which are around the onclick way.</p>