[Solved] How to change audio tag when I click on radio button?


Updated:

<!DOCTYPE html>
<html>
<head>
    <title>Events</title>
</head>
<body>

<input type="radio" value="test2" name="rad" onclick="boom(this.value);">test2
<input type="radio" value="test3" name="rad" onclick="boom(this.value);">test3
<input type="radio" value="test4" name="rad" onclick="boom(this.value);">test4
<br>
    <audio id="audio" controls>
    <source src="" type="audio/ogg">
    <source src="" type="audio/mpeg">
    <source src="https://stackoverflow.com/questions/37552235/test1.wav" type="audio/wav" id="sound">
</audio>
<script type="text/javascript">
    function boom(val){
    var audio = document.getElementById("audio");
        var aud = document.getElementById("sound");
        aud.src=val+".wav";
        audio.load();
    }
</script>
</body>
</html>

https://jsfiddle.net/g1jssesz/2/

4

solved How to change audio tag when I click on radio button?