title: JQuery change value from radio button
body: <p>I have a variable called <code>category</code> that must change its value according to the selected radio button. The problem is that I do not get that at the click of a radio button or another, the value will change instantly. </p>
  
  <p>This is the code I have:</p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="radio" name="category" value="doctor" /&gt; Doctor
  &lt;input type="radio" name="category" value="police" checked /&gt; Policia
  &lt;/form&gt;
  
  var category = $('[name="category"]:checked').val();
  </code></pre>
  
  <p>I need you to automatically change the value of the variable <code>category</code> when you click the radio buttons.</p>