In web designing, how to shuffle the options in a list, like Sololearn does with its questions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

In web designing, how to shuffle the options in a list, like Sololearn does with its questions?

23rd Jul 2017, 2:15 PM
Pranay Saksena
Pranay Saksena - avatar
3 Answers
+ 14
Check out for math.floor( math.random(...) ...) under JS. Btw here's another link which may help you. https://codereview.stackexchange.com/questions/138592/displaying-random-elements-for-a-quiz-app 😊👍
23rd Jul 2017, 3:56 PM
CC Calvello
CC Calvello - avatar
+ 3
You would need to use javascript to randomise html elements. Check here for a simple example: https://www.htmllion.com/shuffle-list-items.html
23rd Jul 2017, 3:43 PM
Bagshot
Bagshot - avatar
+ 2
Check this code: https://code.sololearn.com/WM7RNUsUmLc4/#js It shuffle direct childs of any element query selector (use css query selector syntax to select one or more parent element, and shuffle its direct childs -- no deep shuffle, which can be done recursively ;P)
24th Jul 2017, 7:18 AM
visph
visph - avatar