php - do an autocomplete with PHP, MySQL and Jquery [closed]

0

I'm trying to autocomplete with jquery, and I've found many tutorials, some of which work for me, but at the design level I'd like to do it Bootstrap ... because of the responsive theme more than anything else. Something like that:

Does anyone know how I could do it? Some example? I hope you excuse me, but I'm new to PHP.

    
asked by Raphael 01.06.2016 в 22:25
source

1 answer

4

To use bootstrap with jquery, you could do something like this:

$(function() {
  var availableTags = [
    "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++",
    "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran",
    "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl",
    "PHP", "Python", "Ruby", "Scala", "Scheme"
  ];
  
  $(".autocomplete").autocomplete({
    source: availableTags
  });
});
<link href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"></script>

<div class="container">

  <div class="form-group">
    <label>Languages</label>
    <input class="form-control autocomplete" placeholder="Enter A" />
  </div>
  
  <div class="form-group">
    <label >Another Field</label>
    <input class="form-control">
  </div>

</div>

Response obtained from OS in English, in the following link to the question you can find more ways to do it: link

    
answered by 01.06.2016 / 22:37
source