In Anki I am trying to hide a third field if it is empty. This field is named Ref. In the styling view of a card, accessed by Edit > Cards, I have the following HTML snippet in the back template:
<a href="{{Ref}}">Link</a>
What I wish to know is how to hide the field if it is empty. There is the possibility to add Javascript to the card field, but there is no element inspector in the program.
Bury Card / Note: Hides a card or all of the note's cards from review until the next day. (If you want to unbury cards before then, you can click the “unbury” button on the deck overview screen.) This is useful if you cannot answer the card at the moment or you want to come back to it another time.
To remove a tag from a deck, open the deck, then go to the "Edit Deck" screen, using the menu. The deck's tags are shown in the Tags section. On mobile devices, swipe left on a tag to reveal an "X" button. On desktops and laptops, right-click on the tag to reveal the "X" button.
According to the anki manual, you can use conditionals with {{#Field}} ... {{/Field}}
or {{^Field}} ... {{/Field}}
to test if the field is blank or not. In your case, try something like this:
{{#Link}}
<a href="{{Ref}}">Link</a>
{{/Link}}
I haven't tested it, but it should work.
Edit: It's a bit late, but I realized I mixed up the names of the fields, and the Link
field conditionals should have been called Ref
:
{{#Ref}}
<a href="{{Ref}}">Link</a>
{{/Ref}}
What I ended up doing was the following:
{{#Ref}}<a href="{{Ref}}">Link</a>{{/Ref}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With