2
There was a need to create a text field that would receive names of cities, however complete the word in the field when starting the first digítos.
I need some idea, function with Arrays
literals, more or less so:
<script language="javascript">
function autocompletar()
{
cit = ["uberaba","araxa","colombia"];
str = document.all.txt.value;
for (var i in cit)
{
if (document.all.txt.value.length > 1)
{
str.match(document.all.txt.value=cit[i])
{
}
}
}
}
</script>
Dispenso Bibliotecas nothing personal, I just have no interest.
Do you really have to do this on your arm? If not, here are some implementations of what you need: https://twitter.github.io/typeahead.js/examples/ , https://jqueryui.com/autocomplete/
– mau humor