Skip to content
Advertisement

Javascript IF statement misinterpreting conditions as a function

I’ve been trying to use a modified autocomplete code yet the code for whatever reason the following code will output “Uncaught TypeError: arr[i].substr is not a function at HTMLInputElement.” instead of simply running the function as intended. What’s confusing me about this is that when using a predefined array with finite values the code works exactly as intended, yet when using an array of values that has been extracted from a MySQL database it will output the error.

JavaScript

Advertisement

Answer

Change this:

JavaScript

to this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement