Hi, I’m new to javascript and I’m trying to add a class to the body tag without success.
There are two different request:
- adding front and back class to the two faces of the card
- adding an anki tag as a class
I tryied (first case, on the front template):
<script>
isOnFront=true; //false on the back template
if (isOnFront) {document.body.classList.add("front"); }
</script>
and with conditional formatting also (second case):
{{#tag:Japanese::Hiragana*}}
<span>(Hiragana)</span> //this is a quick test just to see if it works
<script>
document.body.classList.add("{{Tags}}") //automatic, or a specific class like Huragana
</script>
{{/tag:Japanese::Hiragana*}}
where, obviously, Hiragana is a sub tag of Japanese.
The script are from the web, other have been tested too. I intsalled the inspector plug in and the class are not added.
Any help?
Thank you