0

How would I change this:

<audio id ="duck" src="sound.mp3" autoplay ></audio>

to this

<audio id="duck" src="sound.mp3" autoplay loop></audio>

using getElementById ?

Normally I'd use setAttribute but there's no category name here.

1 Answer 1

4

You could do it using the loop property like so:

var audioElement = document.getElementById("duck");
audioElement.loop = true;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.