I'm trying to get array index by value.
I have this code:
var squares = new Array();
for (var i = 1; i <= 160; i++) {
squares.push(i);
}
angular.element('.click').click(function () {
var squareId = angular.element(this).attr('id');
var fisk = squares.indexOf(squareId);
console.log(fisk);
});
This only returns -1, thus, It can't be found. If a replace squareId with a number in indeOf, it works perfect, but if I use a variable, It don't work.
Anyone who can help me?