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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:03:10+00:00 2026-05-29T08:03:10+00:00

I have got my HTML5 project a bit further along – I have one

  • 0

I have got my HTML5 project a bit further along – I have one last stumbling block which is: I have set a variable and have three buttons which give it a different value – each value should relate to a different mp3 file, I want my big ‘play’ button to play whichever mp3 ( variable) has been selected. I then want the button to toggle off or stop playing when clicked again.

I’m out of my depth a bit ( on tip toes) so any help/advice would be appreciated. I have gone through the Jquery and html5 audio notes but can’t find anything too helpful ( that I can understand anyway!)

Thanks for any help,

Jim

  • 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-29T08:03:11+00:00Added an answer on May 29, 2026 at 8:03 am

    Live Demo:

    • http://jsfiddle.net/CZLcR/29/

    JS

    var selectedMP3;
    
    $('input[name=mp3_option]').change(function() {
        selectedMP3 = $('input[name=mp3_option]:checked').val(); 
    });
    
    $('#controlButton').click(function() {
        var $this = $(this);
    
        if($this.text() == 'Play') {
            $this.children().children().text('Pause');
        } else {
            $this.children().children().text('Play');
            alert('Stopped playing song: '+selectedMP3);
            $('input[name=mp3_option]').attr('checked',false).checkboxradio('refresh');
        }
    });
    

    HTML

    <div data-role="page" id="home">
        <div data-role="content">
            <div data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <legend>Choose a song:</legend>
                 <input type="radio" name="mp3_option" id="radio-choice-1" value="song-1.mp3" />
                 <label for="radio-choice-1">MP3 1</label>
    
                 <input type="radio" name="mp3_option" id="radio-choice-2" value="song-2.mp3"  />
                 <label for="radio-choice-2">MP3 2</label>
    
                 <input type="radio" name="mp3_option" id="radio-choice-3" value="song-3.mp3"  />
                 <label for="radio-choice-3">MP3 3</label>
    
                 <input type="radio" name="mp3_option" id="radio-choice-4" value="song-4.mp3"  />
                 <label for="radio-choice-4">MP3 4</label>
        </fieldset>
    </div>
    
    
            <a href="#" data-role="button" data-inline="true" id="controlButton">Play</a>
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so i have got two models with each one controller: Model Project has_many Themes
I have got method which is using Assembly.LoadFrom(...) statement and returns the supported cultures
I have got this project that uses excel for some calculation. This excel is
I am working on a small project and i have got a problem. If
I have a Silverlight 4.0 project which runs fine in VS2010 but when I
I've got a situation where I have a project with several models that have
I've got an ASP.Net project with C# and have a Repeater Control on an
I'm a bit swamped here. I got a project with rather dynamic content, so
I have got this html: <div id=myDiv> <p class=readMore></p> <p class=readMore></p> <p class=readMore></p> </div>
We have got an extjs 3.1.1 form with file upload field ( http://www.extjs.com/deploy/dev/examples/form/file-upload.html from

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.