Need help with making a card template script

I need help making a Script for my Card Template that doesn’t show a Field(Furigana) example: まずい whenever it’s the same as another Field(Kanji) example: まずい. I’ve been trying to make something and I came up with this although it doesn’t work.
I tried if ChatGpt can help me(it couldn’t) but it kinda confused me on where exactly i need to enter this Script for it to work.

Card Template:

{{FrontSide}}

<hr id=answer>

<span style="font-size: 28px;" id="furigana">{{Vocabulary-Furigana}}</span><br>

<script> 
var furiganaText = document.getElementById('furigana').innerText; 
var kanjiText = `{{Vocabulary-Kanji}}`.innerText; 
if (kanjiText === furiganaText) { document.getElementById('furigana').style.display = 'none'; 
} 
</script>

can you give example for Vocabulary-Furigana & Vocabulary Kanji?

If it helps here you go. just an example where the Furigana shouldn’t be shown

I found a solution. I just needed to not use .innerText because it probably just compared the english contents which there are none.

Fixed Code:

<span style="font-size: 28px; "id=furi>{{Vocabulary-Furigana}}</span><br>

<script>

var furigana = `{{Vocabulary-Furigana}}`;

var kanji = `{{Vocabulary-Kanji}}`;

if (furigana == kanji) {

document.getElementById('furi').style.display = 'none';

}

</script>

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