I am having trouble getting the following setTimeouts to work:
$('a').click(function(){
if( last ) {
if( ($(this).attr('id') == last.attr('id')) ) {
setTimeout( function(){
$(this).parent().parent().css('visibility','hidden');
},500);
setTimeout( function(){
last.parent().parent().css('visibility','hidden');
},500);
found++;
}
if (found == 3) {
alert('You won a sticker!');
window.location.href = "#play2";
location.reload(); //resets found to 0
} last = null;
}
else {
last = $(this)
}
});
The functions inside the setTimeout work so that it not the problem. I am wondering if there is something wrong with my syntax. I can't find anything wrong with it, however.