If statement in Anki

Hello everyone.

Is it possible use if statement in Anki cards?

I want to display field if it is contains letter “n”

Thanks.

You can do that with a bit of JavaScript in your template:

<div id=front>{{Front}}</div>

<script>
var frontElement = document.getElementById("front");
if (!frontElement.textContent.toLowerCase().includes('n')) {
    frontElement.textContent = '';
}
</script>
2 Likes