title: Whats wrong in this jQuery dropdown menu code
body: <p>I found that simple snippet which worked perfectly for 2 dependant dropdowns but now i need to add a third dropdown that depend on the selection on the second dropdown, i tried to alter the code but it didn't work, Sorry im totally new in JS.. i just started learning php lately...</p>
  
  <p>Please note that the original snippet was using value for filtering instead of id, and i altered it because i wanna use the select value in POST request.</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>    var $select1 = $( '#select1' ),
        $select2 = $( '#select2' ),
          $select3 = $( '#select3' ), // I added that line but not sure if its correct
          
          $options_a = $select2.find( 'option' );
        $options_b = $select3.find( 'option' ); // I added that line but not sure if its correct
          
      $select1.on( 'change', function() {
       $select2.html( $options_a.filter( '[id="' + this.value + '"]' ) );
      } ).trigger( 'change' );
      
      // I added the next lines for select3 but not sure if they are correct
      $select2.on( 'change', function() {
       $select3.html( $options_b.filter( '[id="' + this.value + '"]' ) );
      } ).trigger( 'change' );</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select name="select1" id="select1"&gt;
          &lt;option value="" disabled selected&gt;Select your option&lt;/option&gt;
          &lt;option value="1" id="1"&gt;Fruit&lt;/option&gt;
          &lt;option value="2" id="2"&gt;Animal&lt;/option&gt;
          &lt;option value="3" id="3"&gt;Bird&lt;/option&gt;
          &lt;option value="8" id="4"&gt;Car&lt;/option&gt;
      &lt;/select&gt;
      
      &lt;select name="select2" id="select2"&gt;
          &lt;option value="" disabled selected&gt;Select your option&lt;/option&gt;
          &lt;option value="1" id="1"&gt;Banana&lt;/option&gt;
          &lt;option value="2" id="1"&gt;Apple&lt;/option&gt;
          &lt;option value="3" id="1"&gt;Orange&lt;/option&gt;
          &lt;option value="4" id="2"&gt;Wolf&lt;/option&gt;
          &lt;option value="5" id="2"&gt;Fox&lt;/option&gt;
          &lt;option value="6" id="2"&gt;Bear&lt;/option&gt;
          &lt;option value="7" id="3"&gt;Eagle&lt;/option&gt;
          &lt;option value="8" id="3"&gt;Hawk&lt;/option&gt;
          &lt;option value="9" id="4"&gt;BWM&lt;option&gt;
      &lt;/select&gt;
      
      &lt;select name="select3" id="select3"&gt;
          &lt;option value="" disabled selected&gt;Select your option&lt;/option&gt;
          &lt;option value="1" id="1"&gt;Small&lt;/option&gt;
          &lt;option value="2" id="2"&gt;Medium&lt;/option&gt;
          &lt;option value="3" id="2"&gt;Large&lt;/option&gt;
          &lt;option value="4" id="3"&gt;Large&lt;/option&gt;
      
      &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>