Back to Freecodecamp

Step 5

curriculum/challenges/english/blocks/workshop-html-music-player/698c50535b54b2d75fa985fb.md

latest1003 B
Original Source

--description--

The loop attribute will restart the audio once playback is completed. Think of an internet meme that repeats playback. Omitting the loop attribute will make the audio play once.

The loop attribute is a boolean attribute and does not need a value.

Add the loop attribute to the audio element.

--hints--

Your audio element should have the loop attribute.

js
const audio = document.querySelector('audio');
assert.isTrue(audio?.hasAttribute('loop'));

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Working with the HTML Audio Element</title>
</head>
<body>
  <h1>freeCodeCamp Tunes</h1>

  <h2>Can't Stay Down</h2>
  <p>Artist: Quincy Larson</p>
  
--fcc-editable-region--
  <audio src="https://cdn.freecodecamp.org/curriculum/js-music-player/can't-stay-down.mp3"></audio>
--fcc-editable-region--

</body>
</html>