Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sql = mysql_query("SELECT id_jabatan, nm_jabatan FROM tbjabatan");
- $options='';
- while($j = mysql_fetch_array($sql)) {
- $options.= '{value:'.$j['id_jabatan'].',label:"'.$j['nm_jabatan'].'"},';
- }
- ?>
- <script>
- $(function() {
- var availableJab = [<?php echo $options;?>];
- $("#nmjab").autocomplete({
- source: availableJab,
- focus: function(event, ui) {
- $("#nmjab").val(ui.item.label);
- return false;
- },
- select: function (event, ui) {
- $("#nmjab").val(ui.item.label);
- $("#idjab").val(ui.item.label);
- return false;
- }
- });
- });
- </script>
- <label for="idjab">Jabatan</label> :
- <!-- id jabatan -->
- <input type="text" name="nmjab" id="nmjab" size="20px" class="inputxt" placeholder="Ketik Jabatan..." />
- <input type="hidden" name="idjab" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement