I have the following Array()
palabras = ["anatomia","ana","angie","anatómico","anatómica","análisis","analogía","analizar","anabólico"];
Now in HTML I have:
<!-- Qué complicado, oh mi Dios -->
<input type="text" name="palabra" class="p">
To capture the value of the input I have:
$(".p").on('input', function(event) {
if ($.inArray($(this).val(), palabras);) {
console.log("Reached!!");
}else{
console.log("Waiting / You're typing...");
}
});
I wish I could capture the word without typing it out in full.
And so what I have only captures if the word is complete in the input :(
All documentation in Autocomplete
One way to solve this problem is " cleaning " (
normalizar
) the words, that is, removing the characters with accents.Steps to perform:
Here is a possible solution.
This question has interested me a lot, for that reason I have designed a simple auto-completer and I hope that my answer will be useful for your problem, Let's see the code:
I have designed it according to your criteria in the question and I have commented the code so that you can understand it quickly, I hope it helps. Greetings!