Hiddenfield works on basic notes but not on notes with lots of fields what's happening?

The following code creates a button when you click on it, it reveals a field. I works fine with a basic note but not on a note with multiple fields. What’s wrong with the code?

<button onclick="toggleHiddenField()">Click to Reveal</button>

<div id="hidden-field" class="hidden">{{Front}}</div>

<script>

function toggleHiddenField() {

var hiddenField = document.getElementById("hidden-field");

hiddenField.classList.toggle("hidden");

}

</script>

You didn’t specify how it doesn’t work, but at a guess, you need to change ‘hidden-field’ to something unique for each field you’re hiding. Or just use hint fields. Field Replacements - Anki Manual

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.