I was trying to make a word fill quiz but got stuck in between:
- looking to shuffle randomly the list items
If the guess is right then how to get to the next blank
$(".btn-container li").click(function () {
let val = $(this).text();
$(".blank:empty:first").html(val);
var optionIndex = $(this).index();
if (optionIndex === blankIndex) {
$(this).prop("disabled", true).addClass('disable');
console.log('right');
} else {
console.log('wrong');
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="content-container">
<p>The bluebird <span class="blank"></span> the <span class="blank"></span> on his <span class="blank"></span></p>
</div>
<div class="btn-container">
<ul id="my_div">
<li><a href="#">carries</a></li>
<li><a href="#">sky</a></li>
<li><a href="#">back</a></li>
</ul>
</div>