Hi, just remove the this in your addEventListener part and change it to btn. And also one suggestion, if you just wanna toggle the status, add the attribute called playStatus to the root div, which is like container to those three divs and simply add and remove your divs to that attribute, instead of changing the status on every div.
Thanks for the feedback. i have tried changing this to btn and still doesn't work. What I mean is that I have 3 div elements and those elements have a <button class='play'> each. And whenever a button is clicked it should indicate on the parent element which is the div that the button is playing a audio. And when i click on the second button from div number two, the data-status='isPlaying' should be on the second div and not the first one anymore
Hi, just remove the
thisin youraddEventListenerpart and change it tobtn. And also one suggestion, if you just wanna toggle the status, add the attribute calledplayStatusto the root div, which is like container to those three divs and simply add and remove your divs to that attribute, instead of changing the status on every div.Thanks for the feedback. i have tried changing
thistobtnand still doesn't work. What I mean is that I have 3divelements and those elements have a<button class='play'>each. And whenever a button is clicked it should indicate on the parent element which is thedivthat the button is playing a audio. And when i click on the secondbuttonfromdivnumber two, thedata-status='isPlaying'should be on the seconddivand not the first one anymoreAlrighty, this is my markup,
And this is my script
Thank you so much...instead of using
button.parentNode.playStatusi used it as a dataset so I can retrieve it later on...Thanks