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 8344935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:31:38+00:00 2026-06-09T06:31:38+00:00

I have two audio tags in these markup. my problem is that the second

  • 0

I have two audio tags in these markup. my problem is that the second one won’t play

<div class="container">
    <div class="post-container">
        <legend>
            <strong>Zedd - Spectrum</legend>
        </h4>
        <div class="art-item">
            <img src="uploads/arts/default.jpg">
        </div>
        <audio class="audio-player" src="uploads/tracks/02 So Far.mp3"></audio>
        <div class="playerContainer">
            <ul id="playerControls">
                <li class="play-bt"></li>
                <li class="pause-bt"></li>
                <li>
                    <div class="progressContainer">
                        <!-- Progess bars container //-->
                        <div class="progressbar"></div>
                    </div>
                </li>
            </ul>
            <span class="timecode">0:00</span>
        </div>
    </div>
    <div class="post-container">
        <legend>
            <strong>Zedd - Spectrum</legend>
        </h4>
        <div class="art-item">
            <img src="uploads/arts/default.jpg">
        </div>
        <audio class="audio-player" src="uploads/tracks/track3.mp3"></audio>
        <div class="playerContainer">
            <ul id="playerControls">
                <li class="play-bt"></li>
                <li class="pause-bt"></li>
                <li>
                    <div class="progressContainer">
                        <!-- Progess bars container //-->
                        <div class="progressbar"></div>
                    </div>
                </li>
            </ul>
            <span class="timecode">0:00</span>
        </div>
    </div>
</div>

And here is the script that plays the track

$(".play-bt").click(function(){
                    var $artItem = $(this).parent(".art-item");
                    console.log($artItem);
                    $artItem.find('audio').play();
                    $artItem.find(".message").text("Music started");
                });

My problem is that I can only play the first audio tag. what can I do to play the second tag or 3rd audio tag if there’s more? the counter is the one that is selecting what audio tags to play. but as of now I have no idea how would I make the second audio tag or user selected audio tag if the are more audio post in this markup.

  • 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-06-09T06:31:41+00:00Added an answer on June 9, 2026 at 6:31 am

    not 100% sure that’s the only issue but you use id a lot. id’s should be unique on a page. Replace them by classes

    And your references are wrong.

    $("#play-bt").click(function(){
        // -> will allways try to play song indicated by counter (0)
        $(".audio-player")[counter].play(); 
        $("#message").text("Music started");
    })
    

    I don’t think you want that? Don’t you want to play the audio in the “post-container” ?

    you could do something like this:

    $(document).ready(function(){
        $(".play-bt").click(function(){
            var $post= $(this).parents(".post-container");
            $post.find('audio')[0].play();
            $post.find(".message").text("Music started");
        });
    });
    

    ​

    => and changing the play-bt and message id’s into classes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few audio files that play for a minute or two in
I have two classes (MVC view model) which inherits from one abstract base class.
I have this problem, I have some audio I wish to play... And I
Alright I have two problems. I'm using AVAudioPlayer to play a simple audio file
I need to record more than one audio at a time. I have two
I have two custom QML elements for audio, one for playing music (and extends
I have followed numerous posts for the last two days. Firefox won't play the
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two queries that find both the Zip codes, and the States for
Please take a look at my simple three-methods Service class that streams audio and

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.