I have a text box where I want to have autocomplete that allows the user to search for addresses. The user should be able to enter different words, and autocomplete should look for them to narrow his list.
I tried and read the documentation, but it doesn't seem to do the trick, since it always searches for a whole line instead of words. Did I miss something?
Example:
When the user enters "Mathias Antwerp", he should see all the addresses containing these words. In this example, it should show 1 row, which is the second.
<script>
var addresses = [
{ name: "Frederick Dereave Gentstreet 4 Gent" },
{ name: "Mathias Derian Meilaan 9 Antwerp" },
{ name: "Mathias Hors frelaan 5 Kortrijk" }
];
$(document).ready(SetAutoComplete);
function SetAutoComplete() {
$("#testveld").autocomplete(emails,
{
matchContains: "word"
}
);
}
</script>
<input type="text" id="testveld" style='width:300px'/>
source
share