# Use SortableJS on AnkiMobile?

**URL:** <https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672>\
**Category:** Card Design\
**Created:** [February 10, 2025, 6:43pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672 "2025-02-10T18:43:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![doubleworker](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/doubleworker/32/14967_2.png) [@doubleworker](https://forums.ankiweb.net/u/doubleworker)\
**Post date:** [February 10, 2025, 6:43pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672/1 "2025-02-10T18:43:42Z")

</div>

I’m working on a Duolingo-type word bank minigame (similar to the [Clozemaster minigame](https://forums.ankiweb.net/t/randomized-multiple-choice-cloze-tests-similar-to-clozemaster-for-anki-desktop-and-mobile-experimental-card-template-mini-game/52843) I shared recently), where you reorder words from a word bank into a sentence. I’ve used [SortableJS](https://github.com/SortableJS/Sortable) so I can drag and drop words into the correct place. It works perfectly on desktop, but I just can’t get it to work on mobile. Any ideas what I’m doing wrong? I feel like the solution must be completely obvious, but I’m not a programmer, and I just can’t figure it out.

Here’s the SortableJS demo, which, again, works on Anki desktop but not mobile:

```html
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>

<!-- Latest Sortable -->
<script src="http://SortableJS.github.io/Sortable/Sortable.js"></script>

<!-- Simple List -->
<ul id="simpleList" class="list-group">
	<li class="list-group-item">This is <a href="http://SortableJS.github.io/Sortable/">Sortable</a></li>
	<li class="list-group-item">It works with Bootstrap...</li>
	<li class="list-group-item">...out of the box.</li>
	<li class="list-group-item">It has support for touch devices.</li>
	<li class="list-group-item">Just drag some elements around.</li>
</ul>

<script>
    // Simple list
    Sortable.create(simpleList, { /* options */ });
</script>

```

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Anon\_0000](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Anon\_0000](https://forums.ankiweb.net/u/Anon_0000)\
**Post date:** [February 10, 2025, 7:52pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672/2 "2025-02-10T19:52:31Z")

</div>

I do not own any apple products so cannot help directly.

But maybe you can gather more info with this:

> [@Is it possible to debug webviews on AnkiMobile?](https://forums.ankiweb.net/t/is-it-possible-to-debug-webviews-on-ankimobile/29874/2):
>
> @krmanik mentioned recently that he’s successfully used [eruda console](https://github.com/ankidroid/Anki-Android/wiki/Development-Guide#via-eruda-console-for-mobile-browsers) on iOS.

That might help to identify the issue and solve your problem.

---

<div class="post-metadata">

**Author:** ![doubleworker](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/doubleworker/32/14967_2.png) [@doubleworker](https://forums.ankiweb.net/u/doubleworker)\
**Post date:** [February 10, 2025, 8:35pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672/3 "2025-02-10T20:35:31Z")

</div>

Thank you, I will look into this.

---

<div class="post-metadata">

**Author:** ![doubleworker](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/doubleworker/32/14967_2.png) [@doubleworker](https://forums.ankiweb.net/u/doubleworker)\
**Post date:** [February 10, 2025, 10:51pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672/4 "2025-02-10T22:51:55Z")

</div>

Got it. I had to use an onload attribute to create the sortable when the script had loaded, as follows:

```html
<script onload="createSortable()" src="http://SortableJS.github.io/Sortable/Sortable.js"></script>

. . .

<script>
function createSortable() {
    Sortable.create(simpleList, { /* options */ });
}
</script>

```

Thank you @Anon_0000 for your help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [March 12, 2025, 10:52pm UTC](https://forums.ankiweb.net/t/use-sortablejs-on-ankimobile/55672/5 "2025-03-12T22:52:55Z")

</div>

Closed on March 12, 2025, 10:52pm UTC

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