<!-- ########################################################################## -->
<div class="form-group">
<label for="varchar">Divre <?php echo form_error('id_divre') ?></label>
<select class="form-control select2" name="id_divre" id="id_divre" data-live-search="true">
<option disabled selected value> -- Pilih Salah Satu -- </option>
<?
$teq= $this->db->query("
SELECT
ref_divre.id_divre,
ref_divre.nama_divre,
ref_divre.code_divre
FROM
ref_divre
");
foreach($teq->result() as $rows_te){
?>
<option value="<?php echo $rows_te->id_divre; ?>" <? if($id_divre==$rows_te->id_divre){echo "selected";}else{echo "";}?> onKeyUp="cek1(this.value)"><?php echo $rows_te->nama_divre; ?></option>
<? } ?>
</select>
</div>
<!-- ########### -->
<div class="form-group">
<label for="varchar">Sub Entitas <?php echo form_error('id_sub_entitas') ?></label>
<select class="form-control select2" name="id_sub_entitas" id="id_sub_entitas" data-live-search="true">
<option disabled selected value> -- Pilih Salah Satu -- </option>
<?
$rse= $this->db->query("
SELECT
ref_sub_entitas.id_divre,
ref_sub_entitas.id_sub_entitas,
ref_sub_entitas.nama_sub_entitas,
ref_divre.nama_divre,
ref_divre.code_divre
FROM
ref_sub_entitas
INNER JOIN ref_divre ON ref_divre.id_divre = ref_sub_entitas.id_divre
");
foreach($rse->result() as $rows_rse){
?>
<!-- class id_divre di ambil dari atas -->
<option id="id_sub_entitas" class="<?php echo $rows_rse->id_divre; ?>" value="<?php echo $rows_rse->id_sub_entitas; ?>" <? if($id_sub_entitas==$rows_rse->id_sub_entitas){echo "selected";}else{echo "";}?> onKeyUp="cek1(this.value)"><?php echo $rows_rse->nama_sub_entitas; ?></option>
<? } ?>
</select>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA6x4GnZ0lXYTW9bwYrZ-W5RWaI9Vbi1yM&libraries=places&callback=initAutocomplete"
async defer></script>
<!-- ########################################################################## -->
<script src="<?php echo base_url('assets/jquery-1.10.2.min.js')?>"></script>
<script src="<?php echo base_url('assets/jquery.chained.min.js')?>"></script>
<script>
$("#id_sub_entitas").chained("#id_divre");
$("#kecamatan").chained("#kota");
</script>
<script src="<?php echo base_url('assets/jquery.chained.min.js')?>"></script>
<script>
$("#id_sub_entitas").chained("#id_divre");
$("#kecamatan").chained("#kota");
</script>
JS Download : Link
No comments:
Post a Comment