Here's my jQuery:
var arr = ['621|342| ','620|343| ','622|342|clicked'];
for (var i=0; i < arr.length; i++){
var splode = arr[i].split('|');
xPos = splode[0];
yPos = splode[1];
click = splode[2];
$('#box').animate({top: yPos+'px', left: xPos+'px'},15);
if (click === 'clicked'){
alert('clicked');
}
}
Basically, I want to wait until variable click shows the text
'clicked' before the alert happens. As it is right now (and with 'for'
and 'while') it alerts 'clicked' at the very beginning depending on
how many times it is in the array.
Any help rocks. Thanks peeps.