I am newbie with javascript. i want to make mini game quiz. But stuck on this logic.
Try see my code below,,, I want to replace div ID \"wrong-gameOne\" with div ID \"co
Please try this code.
$(function () {
var divs = ["wrong1", "wrong2", "wrong3", "wrong4"];
$('#wrong1, #wrong2, #wrong3, #wrong4').click(function () {
$(this).animate({
opacity: 0,
top: 100,
}, 500);
divs.splice(divs.indexOf($(this).prop("id")),1)
if(divs.length == 0){
$('#wrong-gameOne').eq(0).hide();
$('#correct-gameOne').eq(0).show();
}
});
});
Hope this will help you.
Fiddle