Get the index of an element contained into an array, according to the event object
Hi, ive this code
- <div class="contStella" id="stellaquattro"><img class="stellaVota" src="immagini_sito/stella.png"/></div>
Javascript + Jquery
var stelleArray=new Array ( $('#stellauno'), $('#stelladue'), $('#stellatre'), $('#stellaquattro'), $('#stellacinque') )
$('#stellaquattro').mouseover(illuminastelle)
function illuminastelle(event)
{
alert(stelleArray.indexOf(event.target)) // <-this retrive me "-1" that means that the element hasn't been found in the array
}
what's the solution? The event.target is "stellaquattro" right? and for what reason i can't found it into the array?
I tryied event.currenttarget too, without success