Ei
๐ผ Ad Code 2
`
},
{
q:"What has one eye but canโt see?",
options:["Needle","Storm","Camera","Potato"],
correct:0,
reason:"A needle has an eye.",
topAd:`
๐ผ Ad Code 3
`
},
{
q:"What goes up when rain comes down?",
options:["Umbrella","Water","River","Cloud"],
correct:0,
reason:"Umbrella goes up.",
topAd:``
}
];
/* ======================
AUTO QUIZ GENERATOR
====================== */
const quizDiv = document.getElementById("quiz");
questions.forEach((item,index)=>{
quizDiv.innerHTML += `
`;
});
function checkAnswer(qIndex,btn){
const buttons = btn.parentElement.querySelectorAll("button");
const ansBox = document.getElementById("ans"+qIndex);
buttons.forEach(b=>{
b.disabled=true;
if(b.dataset.correct==="true"){
b.classList.add("correct-btn");
}
});
if(btn.dataset.correct==="false"){
btn.classList.add("wrong-btn");
}
ansBox.style.display="block";
}

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home