title: Why is the value of the radio button selected not updating?
body: <p>Whenever I select a new radio button on my HTML, the function newChord() only outputs 1 to the console, no matter the option. For example, if I've selected the button Advanced instead of Beginner, the console should show 3 (associated to Advanced through JS), but it's still only showing 1 (associated to Beginner). The leads me to believe that there's something wrong with the if statements (vague I know...) but I can't figure out why it's working for the beginner option, but not any of the others.</p>
  <p><strong>HTML Code</strong></p>
  <pre><code>&lt;div class=&quot;difficulty_btn&quot;&gt;&lt;br&gt;
            &lt;form&gt;
              &lt;input type=&quot;radio&quot; id=&quot;beginner_btn&quot; name=&quot;difficulty&quot; value=&quot;beginner&quot; checked&gt;
              &lt;label for=&quot;beginner_btn&quot;&gt;Beginner&lt;/label&gt;
  
              &lt;input type=&quot;radio&quot; id=&quot;intermediate_btn&quot; name=&quot;difficulty&quot; value=&quot;intermediate&quot;&gt;
              &lt;label for=&quot;intermediate_btn&quot;&gt;Intermediate&lt;/label&gt;
  
              &lt;input type=&quot;radio&quot; id=&quot;advanced_btn&quot; name=&quot;difficulty&quot; value=&quot;advanced&quot;&gt;
              &lt;label for=&quot;advanced_btn&quot;&gt;Advanced&lt;/label&gt;
  
              &lt;input type=&quot;radio&quot; id=&quot;mixed_btn&quot; name=&quot;difficulty&quot; value=&quot;all&quot;&gt;
              &lt;label for=&quot;mixed_btn&quot;&gt;Mixed&lt;/label&gt;
  
            &lt;/form&gt;&lt;br&gt;
  &lt;/div&gt;
  </code></pre>
  <p><strong>Javascript Code</strong></p>
  <pre><code>function newChord() {
      
      if ($(&quot;input[name='difficulty']:checked&quot;).val('beginner')) {
          console.log(1);
          
      } else if ($(&quot;input[name='difficulty']:checked&quot;).val('intermediate')) {
          console.log(2);
  
      } else if ($(&quot;input[name='difficulty']:checked&quot;).val('advanced')) {
          console.log(3);
          
      } else if ($(&quot;input[name='difficulty']:checked&quot;).val('all')) {
          console.log(4);
      }
  }
  </code></pre>
  <p>Any help is appreciated, thanks in advance.</p>