Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <audio id="myAudio1" controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <audio id="myAudio2" controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio><br> <button onclick="setMedGroup()" type="button">Set media group for audios</button> <button onclick="getMedGroup()" type="button">Get media group for audios</button> <script> var x = document.getElementById("myAudio1"); var y = document.getElementById("myAudio2"); function setMedGroup() { x.mediaGroup = "test"; y.mediaGroup = "test"; } function getMedGroup() { alert("Audio 1 media group: " + x.mediaGroup + ". Audio 2 media group: " + y.mediaGroup); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_audio_mediagroup by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:31:13 GMT --> </html>
Result:
Try it Yourself - © w3schools.com