# Help with Incremental Cloze Reveal

**URL:** <https://forums.ankiweb.net/t/help-with-incremental-cloze-reveal/54788>\
**Category:** Card Design\
**Created:** [January 23, 2025, 7:38pm UTC](https://forums.ankiweb.net/t/help-with-incremental-cloze-reveal/54788 "2025-01-23T19:38:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [January 23, 2025, 8:50pm UTC](https://forums.ankiweb.net/t/help-with-incremental-cloze-reveal/54788/2 "2025-01-23T20:50:31Z")

</div>

You have a function that gets called onclick named `revealCloze(i);`. This same function could also hide the cloze again. For that you would:

- add an if statement checking if the .cloze had been revealed,
- change the cloze’s text back to what it was before revealing and
- then declare that the cloze is not revealed anymore:

```auto
function revealCloze(i) {
  if (!revealed[i]) {
    elements[i].innerHTML = clozes[i];
    revealed[i] = true;
  } else if (revealed[i]) {
    elements[i].innerHTML = "[...]";
    revealed[i] = false;
  }
}

```

---

_[View the full topic](https://forums.ankiweb.net/t/help-with-incremental-cloze-reveal/54788)._
