title: change other select value on select with jquery
body: <p>I have code like below, that code give me two select option , how to change select value on class kecamatan when I select value on class kota_kabupaten,</p>
  
  <p><strong>for example</strong> : when I select "tangerang" in first select option(class kota_kabupaten) and then in the second select(class kecamatan) the values will be "balaraja" and "bitung" without "balong" in there.</p>
  
  <p>thanks before for your help :D</p>
  
  <p><strong>javascript</strong>  </p>
  
  
  
  <pre><code>&lt;script type="text/javascript"&gt;
     $(document).ready(function(){
        $(".kota_kabupaten").change(function(){                   
        var kab = $(".kota_kabupaten option:selected").val();
        //do something here
     });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>html/php</strong></p>
  
  <pre><code>&lt;select class="form-control kota_kabupaten"&gt;
    &lt;?php
       $kab = array(
       'tangerang'=&gt;array('balajara','bitung'),
       'banten' =&gt; array('balong')
        );
       foreach ($kab as $kab =&gt; $kecamatan){
       echo "&lt;option value=".$kab."&gt;".$kab."&lt;/option&gt;" ;
        }
  ?&gt;
  &lt;/select&gt;
  &lt;select class="form-control kecamatan" name = "kecamatan" id="kecamatan"&gt;
      &lt;?php
       $kab = array(
          'tangerang'=&gt;array('balajara','bitung'),
          'banten' =&gt; array('balong')
          );
          $kabupaten="tangerang"; // this line just for example when the value is exist
        foreach ($kab as $kab =&gt; $kecamatan){
          if(is_array($kecamatan)){
            foreach ($kecamatan as $key =&gt; $value) {
              if($kab==$kabupaten){
              echo "&lt;option value=".$value."&gt;".$value."&lt;/option&gt;" ;
              }
            }
          }  
        }
      ?&gt;
    &lt;/select&gt;
  </code></pre>