title: Rails & Javascript check which radio button is selected
body: <p>This is the code of my view (in a form_for)</p>
  
  <pre><code>&lt;div class="form-group col-xs-6"&gt;
     &lt;%= f.label :Competition_type %&gt; &lt;br&gt;
     &lt;%= f.radio_button :type_competition, :value =&gt; "regression", :checked =&gt; true, id: "type_regression" %&gt;
     &lt;%= f.label :type_competition, "Regression"%&gt;
     &lt;%= f.radio_button :type_competition, :value =&gt; "classification", id: "type_classification" %&gt;
     &lt;%= f.label :type_competition, "Classification"%&gt;
  &lt;/div&gt;
  &lt;div class="form-group col-xs-6"&gt;
     &lt;%= f.label :Performance_metric %&gt;
     &lt;%= f.select(:metric, options_for_select([['Mean Absolute Error'],['Root Mean Squared Error'],['Weighted Mean Absolute Error'], ['Accuracy'],['Mean Utility']]), {}, {class: "form-control", id: "selectMetric"}) %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Somebody helps me to do a function in JavaScript (and/or JQuery) so that when the radio button "regression" is selected, the select options show only ['Mean Absolute Error'],['Root Mean Squared Error'],['Weighted Mean Absolute Error'], and when the radio button "classification" is selected show only the others options: ['Accuracy'],['Mean Utility']. </p>
  
  <p>I will thank you very much. I don't know to do this and I need that to continue my final project of the university.</p>