Auto completing input with address

2

Is there any API that when typing the name of a city for example, will the suggestion appear as the name of the city below the form? Please do not send the Google Place Autocompleter, I need an API that will provide the city and state suggestion, for example:

  • Santos, SP
asked by anonymous 20.03.2014 / 01:23

3 answers

4

Have you ever used jquery?

site: jquery.com

License: link

An example of AutoComplete.

    <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(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
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
</body>
</html>

Autocomplete

    
20.03.2014 / 01:31
2

See Link .

Example:

var cidades = [
           { data: 'es_afonso_claudio', value: 'Afonso Cláudio - ES' },
           { data: 'es_alegre', value: 'Alegre - ES' },
           { data: 'es_alfredo_chaves', value: 'Alfredo Chaves - ES' },
           { data: 'es_alto_rio_novo', value: 'Alto Rio Novo - ES' },
        ]

$('#cidades').autocomplete({
            lookup: cidades,
            onSelect: function(suggestion){
                alert(suggestion.value  + ' : ' + suggestion.data);
            }
        });

In this case, #cidade s is the ID of the input text.

    
20.03.2014 / 12:30
0

Hello, take a look at the Twitter Typeahead .

It is an autocomplete component that allows the inclusion of default data that is sent on the page for quick access.

I'd recommend getting to know you!

    
20.03.2014 / 14:43