Бронислав,
учите язык и документацю на плагин
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.css"/>
<style>
#search-query {
width:300px;
padding:5px 10px;
margin-left:10px;
}
/****** jQuery Autocomplete CSS *************/
.ui-corner-all {
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.ui-menu {
border: 1px solid lightgray;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 15px;
background-color: white;
}
.ui-menu .ui-menu-item a {
color: #888;
display: block;
}
.ui-menu .ui-menu-item a:hover {
border: 1px solid lightgray;
}
.ui-menu .ui-menu-item:hover {
display: block;
text-decoration: none;
color: #3D3D3D;
cursor: pointer;
background-color: lightgray;
background-image: none;
border:0;
}
.ui-widget-content .ui-state-hover, .ui-widget-content .ui-state-focus {
border: 1px solid lightgray;
background-image: none;
background-color: lightgray;
font-weight: bold;
color: #3D3D3D;
}
</style>
</head>
<body>
<label>Search:</label>
<input id="search-query" type="text" />
<script>
var $_searchQuery = $("#search-query");
var availableTags = [
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
var err = "";
$_searchQuery.autocomplete({
close: function(event, ui) {if(availableTags.indexOf(this.value)==-1) err = "поле Откуда обязательно к заполнению"},
open : function(event, ui) {err = ""},
source: function(request, response) {
var max = 2;
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( request.term ), "i" );
response(availableTags.filter(function(item) {
return matcher.test( item );
}).splice(0,max))
}
});
$_searchQuery.on("blur", function() {
err && alert(err)
})
</script>
</body>
</html>