Closed unectomy closed 1 month ago
I think the issue is with Anki, not the deck. I used the AnkiWebView Inspector add-on and found that double quotation marks in attributes were messing up the JavaScript parsing inside <script>
tags. I found the solution to my problem in a Reddit thread where you make a new tag, put your desired field text in there, and then extract the text with more JS. Here is my updated front template:
<div id='expression-field'>{{Word}}</div>
<div id='hint-field'>{{Hint}}</div>
<!--If the word is hiragana/katakana only, display the sentence in the hint field.-->
<div id=getSentence hidden>{{Sentence}}</div>
<script>
if ("{{Word}}" === "{{Reading}}") {
if (document.getElementById('hint-field').childNodes.length === 0) {
var hintText = getSentence.innerHTML
document.getElementById('hint-field').innerHTML = hintText
}
}
</script>
This template has a feature where, if the Word and Reading fields are the same, the Sentence field's contents will appear in the Hint field on the front side of the card. However, I found that if the Sentence field has an HTML attribute in it, this feature doesn't work. How do I fix it?