Im trying to make an audio file automatically play once a checkbox is checked. My initial idea was to have the audio tag on autoplay, and configure the CSS like this:
audio {
display: none;
}
[type="checkbox"]:checked~audio {
display: inline;
}
This doesnt work, of course; the audio will simply play as the website is loaded. Anyone know how to accomplish this? Perhaps some way to make the same space as the checkbox' <label>
tag be used to play the audio. Thank you.
Aucun commentaire:
Enregistrer un commentaire