I have a mail feed where you can press the play button and the play button will switch to the pause button, however, when I press one of the play buttons, both pause buttons switch (for each message) How do I let Javascript switch the single play button to feed if there are several classes with the same name on the page.
What does it look like when I press the top play button (both pause buttons switch when only the top should change):

Here is the HTML:
<div class="media-circle"> <i class="icon ion-ios-play"></i><i class="icon ion-pause feed-pause"></i> </div>
Here is the Javascript:
jQuery('.media-circle').click(function (e) { e.preventDefault(); jQuery(this).find('i').toggleClass('ion-ios-play'); jQuery('.feed-pause').toggle(); //this controls universal bottom bar play button jQuery('#bottom-play-button-container').find('i').toggleClass('ion-ios-play').toggleClass('ion-pause'); });
Here is the JS for the bottom play button (pretty similar) EDIT *
jQuery('#bottom-play-button-container').click(function (e) { e.preventDefault(); jQuery(this).find('i').toggleClass('ion-ios-play').toggleClass('ion-pause'); jQuery('#play-pause-toggle').find('i').toggleClass('ion-ios-play').toggleClass('ion-pause'); jQuery('.media-circle').find('i').toggleClass('ion-ios-play'); jQuery('.feed-pause').toggle(); });
source share