Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
Anki: How to load javascript file at first question?

I've put the following _mydeck.js file in the collection.media/ folder:

var count = ++count || 1

if (count == 1) {
  var niverennou = niverennou || [
    "zero", "unan", "daou", "tri", "pevar",
    "pemp", "c'hwec'h", "seizh", "eizh", "nav", "dek"
  ];
}

Then, in the question (Front) of a card of my deck, I have:

<script src="_mydeck.js"></script>

{{Kentel}}
<div id="kentel"></div>

<div id="debug">0</div>

<script>

// Javascript File Loading Count
document.getElementById("debug").innerHTML = count;

// Lessons number in letters
document.getElementById("kentel").innerHTML = niverennou[{{Kentel}}];

</script>

When a first card's question is displayed, the debug counter shows 0 meaning that the javascript file is not yet loaded. Then when showing the answer and further cards, the debug counter is incremented and the kentel variable is properly set.

How can I have the javascript file taken into account as soon as the first card's question is loaded ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!