I want to make a div display text when I clicked on it
I have this code and it supposed to make the image inside the "songPlay" div display "demo" text when I clicked it but it doesnt. I dont know anything about js so please help me. Thankyou
This is the code:
<script>
var tag = document.getElementById('demo');
var button = document.querySelector('songPlay');
button.addEventListener('click', function(){
tag.classList.toggle('demo');
});
</script>
<p id='demo'>Audio is playing</p>
<div id="flex-container">
<div id="flex-container2">
<div id="songPlay" onclick="play('song'); toggleText();">
<div class="play1">
<img src="images/play.png" width="15px" height="15px">
</div>
</div>