var odd = [1, 3, 5, 7, 9];
function testFunction() {
numbers = document.getElementById("inputfield").value;
alert(odd.indexOf(numbers[0]));
}
It alerts "-1" for some reason, even if I split "number" first to turn it into an array.
I even tried index=number[0];
and then alert(odd.indexOf(index));
but it's still not working
Here is a demo http://jsfiddle.net/y0ruba/NUzAD/