Back Template → {{type:answer}} → I'd like to QUERY: has something been typed into the TypeBox, YES or NO?

e.g.

{{#typeBoxHasCharacters}}
…
{{/typeBoxHasCharacters}}

or

{{^typeBoxHasCharacters}}
…
{{/typeBoxHasCharacters}}

Is there any way this is already possible … :wink:

Try something like this:

<script>
if(document.querySelector("#typeans").value) {
   // typebox contains something
} else {
  // ...
}
</script>

Thanks for replying; this doesn’t look too noob-friendly … :wink:

The problem I’m trying to solve:

{{type:answer}} <br>
{{answer}} <br>

If I don’t type the answer (90%+ of cases), it’s still displayed twice; not a real problem, but annoying …

If I remove the {{answer}} tag, then any additional emphasis (bold is this case) will be lost, which IS a real problem …

Just realized your question is about the back template. This won’t actually work then. Try this instead:

{{type:answer}}
{{answer}}

<script>
(() => {
    const typeans = document.querySelector("#typeans")
    if(!typeans.querySelector("#typearrow")) {
        typeans.remove();
    }
})();

</script>
2 Likes

Just tried this; seems to work fine, thanks :smiley: :smiley:

In fact, this is so cool that it might as well work like this ‘out of the box’, IMHO … :wink: