JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrapper">
<div class="question">
question1
</div>
<div class="question">
question2
</div>
<div class="question">
question3
</div>
</div>
JavaScript
function shuffle(array) {
var counter = array.length, temp, index;
// While there are elements in the array
while (--counter > -1) {
// Pick a random index
index = (Math.random() * counter) | 0;
// And swap the last element with it
temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array;
}
var shuffled = shuffle($('.question'));
$('#wrapper').html('');
for (var a = 0; a < shuffled.length;a++) {
$('#wrapper').append(shuffled[a]);
}