HTML Play button coding

1 Jahr 1 Woche her #173547 von GrantLab
HTML Play button coding wurde erstellt von GrantLab
I am attempting to code in a one-press play button for a survey (so that participants can play a song but not pause it during listening). I had it working in Qualtrics previously using the following code:

<audio id="audio1" src=" "></audio>
<button onclick="document.getElementById('audio1').play()">Play</button>

I have altered the code in LimeSurvey as such:

<audio id="audio1" src=" " type="audio/mpeg"> </audio>

<div><button onclick="document.getElementById('audio1').play()">Play</button></div>

My issue is that the Play button will display but it won't play the song when clicked. Instead it refreshes the current question when I test it in Survey preview. Anyone see what is wrong with the coding here? I'm a major newbie with HTML.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
1 Jahr 1 Woche her #173567 von tpartner
Add a type="button" attribute. This should prevent the button from submitting the form.
<button type="button" onclick="document.getElementById('audio1').play()">Play</button>

Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner -
Folgende Benutzer bedankten sich: DenisChenu

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey