title: how to disable select with condition on value from database
body: <p>How to disabled select "pelajaran" where condition select jabatan = "operator" </p>
  
  <pre><code>&lt;select name="id_jabatan" id="jabatan" size="1" class="form-control"  required&gt;
      &lt;option label="-- Pilih Jabatan --"&gt;&lt;/option&gt;
      &lt;?php //query untuk looping jabatan
          $sql = "SELECT * FROM tb_jabatan_guru";
          $result = $koneksi-&gt;query($sql);
          while ($row = $result-&gt;fetch_array()){ ?&gt;
      &lt;option value="&lt;?php echo $row['idJabatan'] ?&gt;"&gt;&lt;?php echo $row['namaJabatan']; ?&gt;&lt;/option&gt;
      &lt;?php } ?&gt;
  &lt;/select&gt;
  
  
  &lt;select name="id_pel" id="pelajaran" size="1" class="form-control" disabled required&gt;
      &lt;option label="-- Pilih Pelajaran --"&gt;&lt;/option&gt;
      &lt;?php //query untuk looping pelajaran
          $sql = "SELECT * FROM tb_pelajaran";
          $result = $koneksi-&gt;query($sql);
          while ($row = $result-&gt;fetch_array()){ ?&gt;
      &lt;option value="&lt;?php echo $row['idPelajaran'] ?&gt;"&gt;&lt;?php echo $row['namaPelajaran']; ?&gt;&lt;/option&gt;
      &lt;?php } ?&gt;
  &lt;/select&gt;
  
  
  &lt;script&gt;
      document.getElementById('jabatan').onchange = function () {
          document.getElementById("pelajaran").disabled = this.value == 'Operator';
      }
  &lt;/script&gt;
  </code></pre>