- Enter the sentences into a card’s field as a list. You can ask AI to output the HTML code in the following format and paste it into a source code editor (the
<>
button in the top right corner of the field in the Anki Editor):<ol><li>Sentence1</li><li>Sentence2</li><li>Sentence3</li>....</ol>
- Wrap the {{SentenceField}} in your card template in a div:
<div id="randomize">{{SentenceField}}</div>
- Paste the following JS code at the bottom of the same template:
<script> items = document.getElementById("randomize").children[0]?.children; randomIndex = Math.floor(Math.random() * items.length); items[randomIndex].classList.add("selected"); </script>
- Add the following styles to the Styling tab:
#randomize > * { list-style:none; margin: 0; padding: 0; } #randomize > * > * { display: none; } #randomize > * > .selected { display: inline; }
1 Like