Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6694823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:08:49+00:00 2026-05-26T06:08:49+00:00

I have a page that loads a dynamic number (however many in the database

  • 0

I have a page that loads a dynamic number (however many in the database marked active) of “voting panels” with an image and blurb and an audio clip of artists who are being voted on as favorite. I mashed together some jQuery to “activate” a play button that when clicked starts the correct clip AND is src.replaced with a stop button. When the stop button is clicked, the clip stops and the play button returns. I also managed to get the playing clip to STOP when another play button is clicked so there is only one clip playing at a time.

HOWEVER, what I can’t seem to figure out is how to change the stop button back to a play button for a clip that was playing and was interrupted by a different play button.

The site is up as a test but is set to go live with undiscovered artists on Monday so I have to figure this out. You can see my dilemma at http://dev.edrtrust.com/play/index.php/ppm/artist_faceoff.

Here is my jQuery code:

  $("img.btnPlay").live('click', function () {
    var thisPID = $(this).attr('name');
    this.src = this.src.replace("<?= base_url(); ?>assets/images/playThis.png",
         "<?= base_url(); ?>assets/images/stopThis.png");
    $(this).removeClass("btnPlay").addClass("btnStop");
    $.ajax({
        type: "POST",
        url: "<?php echo site_url('ppm/getVoteClip'); ?>",
        data: {
            id: thisPID
        },
        success: function (msg) {
            $("#clip").empty().html(msg);
            var plyr0 = document.getElementById('faceoffAudio0');
            plyr0.play();
        } // end success
    }); // end ajax
}); // end play button

and

$("img.btnStop").live('click', function () {
    var plyr0 = document.getElementById('faceoffAudio0');
    plyr0.pause();
    this.src = this.src.replace("<?= base_url(); ?>assets/images/stopThis.png", 
         "<?= base_url(); ?>assets/images/playThis.png");
    $(this).removeClass("btnStop").addClass("btnPlay");
}); // end stop button
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:08:50+00:00Added an answer on May 26, 2026 at 6:08 am

    If you only need one button to say ‘stop’ at a time, then you can just check for any buttons with the class of .btnStop and change those back to play buttons.

    $("img.btnPlay").live('click', function () {
    
        // update buttons on other players
        $(".btnStop").each(function(index, element){
            element.src = element.src.replace("<?= base_url(); ?>assets/images/stopThis.png",
            "<?= base_url(); ?>assets/images/playThis.png");
            $(element).removeClass("btnStop").addClass("btnPlay");
        });
        // end update buttons on other players
    
        var thisPID = $(this).attr('name');
        this.src = this.src.replace("<?= base_url(); ?>assets/images/playThis.png",
            "<?= base_url(); ?>assets/images/stopThis.png");
        $(this).removeClass("btnPlay").addClass("btnStop");
    
        $.ajax({
            type: "POST",
            url: "<?php echo site_url('ppm/getVoteClip'); ?>",
            data: {
                id: thisPID
            },
            success: function (msg) {
                $("#clip").empty().html(msg);
                var plyr0 = document.getElementById('faceoffAudio0');
                plyr0.play();
            } // end success
        }); // end ajax
    }); // end play button
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem. So I have this page that loads dynamic content
I have a page that loads dynamic content via ajax. When I scroll down
I have a dynamic dialog being created that loads a page. The close buttons
I have a page that loads a bunch of scripts to prepopulate dropdowns and
I have a .aspx page that loads three separate .ascx controls to represent adding,
I have an asp page that loads a response user=exists everytime I try to
I have a web application that has a page that loads the content from
The Idea I have a main PHP page that loads content in DIV's from
I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads
I have a page that dynamically loads content based on a user pushing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.