# Selective autoplay of audio for certain notes

**URL:** <https://forums.ankiweb.net/t/selective-autoplay-of-audio-for-certain-notes/47544>\
**Category:** Card Design\
**Created:** [July 27, 2024, 9:28pm UTC](https://forums.ankiweb.net/t/selective-autoplay-of-audio-for-certain-notes/47544 "2024-07-27T21:28:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Keks](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/keks/32/20537_2.png) [@Keks](https://forums.ankiweb.net/u/Keks)\
**Post date:** [July 27, 2024, 9:42pm UTC](https://forums.ankiweb.net/t/selective-autoplay-of-audio-for-certain-notes/47544/2 "2024-07-27T21:42:49Z")

</div>

Perhaps some of the code will be useful.

> [@Add a loop audio button](https://forums.ankiweb.net/t/add-a-loop-audio-button/14063/11):
>
> Ok, in case anybody is interested (@milad, @Ribeiro, @Jord, @Shiori), I found a way to do this with a script (thanks to ChatGPT!). Just add this code to the template where you want to have the button. Simple version: \<div id="audio-container"\> \<audio id="audio-player"\> \<source src="{{Loop}}" type="audio/mpeg" /\> \</audio\> \<button id="loop-button"\>Loop Audio\</button\> \</div\> \<script\> document.getElementById('loop-button').addEventListener('click', function() { var audio = document.ge…

---

_[View the full topic](https://forums.ankiweb.net/t/selective-autoplay-of-audio-for-certain-notes/47544)._
