· 7 years ago · May 08, 2019, 10:30 AM
1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery UI Autocomplete - Default functionality</title>
7 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
8 <link rel="stylesheet" href="/resources/demos/style.css">
9 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
10 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
11</head>
12<body>
13
14<script>
15 $( function() {
16 var email = ["@gmail.com", "@mail.ru"];
17
18 $( "#tags2" ).autocomplete({
19 delay: 0,
20 source: function (request, response) {
21 let name = $("#tags2").val();
22 let newData =[];
23 $.each(email, function(index, tag) {
24 newData.push(name + tag);
25 })
26 response(newData);
27
28 }});
29 } );
30</script>
31
32<div class="ui-widget">
33 <label for="tags2">login: </label>
34 <input id="tags2">
35</div>
36
37
38</body>
39</html>