JQuery seems to be broken after V3 updates to website

I have been using Ankiweb to review some cards that make use of templates with jquery for nearly a year. A couple of days ago, the cards stopped working.

When checking the chrome dev tools, it seems to be erroring out on a line using $-related Jquery stuff.

Any advice would be great.

For example (a developer for the card templates i’m using determined this basic template doesn’t work either on ankiweb):

<div>question jQuery: <span id="question"></span></div>
<div>question JavaScript: <span id="question2"></span></div>
<script>

$('#question').html("{{ Kanji }}");

document.getElementById("question2").innerHTML = " {{ Kanji }} ";

</script>

Unfortunately this is a case of https://www.hyrumslaw.com/. jQuery was an implementation detail that some shared deck authors started to rely on. We’re now forced to either provide it indefinitely (despite Anki not using it), or encourage people to move to more modern approaches (a lot of what jQuery offered is available out of the box in browsers these days).

The breakage on AnkiWeb was unintentional, but now that it’s happened, I’m wondering whether it might be a way to nudge people to update their templates, without breaking things for the whole ecosystem at once. For cases where a shared deck author is no longer responsive, it may be sufficient to drop something like the following into the top of your card template.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>

Thanks, that works.

Just curious, why was JQuery removed in the first place?

As mentioned above, most of this functionality is available out of the box these days. Modern JS tends not to rely on jQuery, as it adds extra loading time to the page for marginal benefit. AnkiWeb’s interface was recently rewritten, and the new code no longer needs jQuery.

1 Like

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