…click event handlers outside of the realm of this code block…
And this is exactly your failure. Your code looks wrong.
Try to do it like the following example…
$w.onReady(function () {
wixData.query("TrekGolfTrivia")
.find()
.then(res => {
quizQuestions = res.items;
quizQuestions = shuffle(quizQuestions);
quizQuestions = quizQuestions.slice(0, 9);
$w("#quizRepeater").data = quizQuestions;
});
$w("#quizRepeater").onItemReady(($i, iData, index)=>{
$i('#yourButtonIDhere').onClick(()=>{
displayQuestions;
});
});
});
… you do not show the rest of your code, so it is not clear what else you have in your function.