Customizing the Autocomplete UI JQuery

0

Hello! I put the autocomplete ui jquery on my system, it's working as it should, but I wanted to edit the look of it.

For example, putting a background color in the suggestions that appear and not allowing the creation of a <div> when selecting a value.

This is the autocomplete image as it is:   

TheautocompletetemplateI'musingisthis link

    
asked by anonymous 06.03.2018 / 18:08

1 answer

2

You can change the color of the search results box by changing via CSS the style of div #ui-id-1 , which is the div of the results of the plugin:

<style>
#ui-id-1{
   background: red; /*fundo vermelho*/
}
</style>

Example:

$( 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"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  } );
#ui-id-1{
   background: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkrel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script><divclass="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags">
</div>

When at div

06.03.2018 / 19:43