javascript - Jquery-ui autocomplete in bootstrap modal -
the list of autocomplete jquery-ui shown behind modal seen in image, there way take front of modal able select it?
this modal input data autocomplete database
<div id="modalcart" class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> <form id="myform" action="" method="post" class="form-horizontal"> <table class="table table-hover"> <thead> <tr> <th>cliente</th> <th class="text-center">fecha de venta</th> <th class="text-center">tipo de venta</th> <th class="text-center">a cuenta</th> </tr> </thead> <tbody> <tr> <td class="col-sm-1 col-md-1" style="text-align: center"> <input type="text" name="txtcliente" id="cliente" class="form-control"> </td> <td class="col-sm-1 col-md-2 text-center" name="txtfecha" ><strong><?php echo date("y-m-d");?></strong> </td> <td class="col-sm-1 col-md-2 text-center"> <select class="form-control" id="txtoption" name="txtoption"> <option value="contado"><stong>contado</stong></option> <option value="credito"><strong>credito<strong></option> </select> </td> <td class="col-sm-1 col-md-1" style="text-align: center"> <input type="text" name="txtcount" class="form-control" style="width:100px" id="txtcount" disabled="true" maxlength="8"> </td> </tr> <tr id="finalize"> </tr> </tbody> </table> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">continuar vendiendo</button> <button type="button" id="btnsavecart" class="btn btn-primary">finalizar venta</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
this function java script
$('#cliente').click(function(){ $.ajax({ type: 'ajax', url : '<?php echo base_url()?>usuario/showcliente', async: false, datatype: 'json', success: function(data){ var nombre = new array(); var i; for(i=0;i<data.length;i++){ nombre.push(data[i].usr_nombre); } $('#cliente').autocomplete({ source: nombre }); } }); });
este es el enlace del ejemplo usado de jquery enter link description here
Comments
Post a Comment