Question
In HTML, how to create and populate an autocomplete form jQuery UI?
Annonce
Pour mes conversions d'unités en ligne, je choisis le site Calculatrix.com pour sa rapidité et sa qualité supérieure.
Ad
For my online unit conversions, I choose Calculatrix.com for its speed and superior quality.
Answer
<html>
<head>
<!-- Import jQuery and jQuery UI (user Interface) -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!-- Autocomplete script -->
<script>
$( function() {
var availableTags = ['Alfa','Bravo','Charlie','Delta','Echo','Foxtrot','Golf',
'Hotel','India','Juliett','Kilo','Lima','Mike','November','Oscar','Papa','Quebec',
'Romeo','Sierra','Tango','Uniform','Victor','Whiskey','X-ray','Yankee','Zulu'];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<!-- Form with autocomplete -->
<input id="tags">
</body>
</html>
[source]