# Cloze one by one uncovering

**URL:** <https://forums.ankiweb.net/t/cloze-one-by-one-uncovering/12584>\
**Category:** Card Design\
**Created:** [August 23, 2021, 10:05pm UTC](https://forums.ankiweb.net/t/cloze-one-by-one-uncovering/12584 "2021-08-23T22:05:10Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![shallash](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/shallash/32/4363_2.png) [@shallash](https://forums.ankiweb.net/u/shallash)\
**Post date:** [September 30, 2021, 7:24am UTC](https://forums.ankiweb.net/t/cloze-one-by-one-uncovering/12584/16 "2021-09-30T07:24:35Z")

</div>

> [@kleinerpirat](#):
>
> I’m planning to release it to the public eventually, but currently, it is still way too complex and specific for general use.

Consider me very intrigued. 🙂

I was able to solve the issue after reading the guide, and a few hours of stumbling around, and here’s what i came up with, for anyone interested in using clozes that reveal incrementally on keypress, and also reveal on clicking/tapping them, _ **with Closet clozes** _.

> **The Script**
>
> In the end I went with a quite different approach from the script I found on [closetengine.com](http://closetengine.com) . Mostly because I could not make head or tails of it.
> 
> ```javascript
> if (typeof doc_keyUp !== "function") {
> var doc_keyUp = function(e) {
> if (e.key === "z" || e.code === "Numpad0") {
> flipVisibility();
> } else if (e.code === "NumpadDecimal") {
> removeObscureOnKd();
> }
> };
> document.addEventListener("keyup", doc_keyUp, false);
> }
> 
> function flipVisibility() {
> if (document.getElementById('hintzu').style.display == 'none') {
> document.getElementById('hintzu').style.display = 'block';
> } else {
> document.getElementById('hintzu').style.display = 'none';
> }
> }
> 
> function removeObscureOnKd() {
> var firstCloze = document.getElementsByClassName('cl--obscure')[0];
> firstCloze.classList.remove('cl--obscure')
> firstCloze.classList.remove('cl--obscure-hint')
> firstCloze.classList.remove('cl--obscure-fix')
> }
> 
> ```
> 
> This script should work fine if you’re using the closet setup script found in my previous post on this thread.
> 
> The relevant function here is `removeObscureOnKd`, so you can change the keyboard shortcut to whatever you want to using [https://keyjs.dev](https://keyjs.dev) .
> 
> The `flipVisibility` function is for a button to toggle the visibility of some content, it functions basically like the `<details>` tag, except with a keyboard shortcut too. If someone wants i’ll post how to make it work for your notetype. I used one eventlistener for both functions because it seems efficent to do so.

---

_[View the full topic](https://forums.ankiweb.net/t/cloze-one-by-one-uncovering/12584)._
