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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:16:04+00:00 2026-05-30T23:16:04+00:00

I have a play, pause button which controlled by JQuery, when I click play

  • 0

I have a play, pause button which controlled by JQuery, when I click play button it becomes hide and next I click to pause the opposite action will fuinctioning. The problem is I have more than 5 pairs of buttons with the same class, so when I click the first play button suddenly shows the other pause buttons too.. how can I overcome this? I know I can give each <a> tags to separate classes/IDs..but is there for any other solutions?

here is the html I have..

    <div>
    <img src="images/quicktime_logo.gif" width="32" height="30" alt="Quicktime" border="0" align="left" />
    <a href="javascript:document.movie1.Play();" class="quicktime_play_btn"></a>
    <a href="javascript:document.movie1.Stop();" class="quicktime_pause_btn"></a>
    </div>

<div>
    <img src="images/quicktime_logo.gif" width="32" height="30" alt="Quicktime" border="0" align="left" />
    <a href="javascript:document.movie1.Play();" class="quicktime_play_btn"></a>
    <a href="javascript:document.movie1.Stop();" class="quicktime_pause_btn"></a>
    </div>

<div>
    <img src="images/quicktime_logo.gif" width="32" height="30" alt="Quicktime" border="0" align="left" />
    <a href="javascript:document.movie1.Play();" class="quicktime_play_btn"></a>
    <a href="javascript:document.movie1.Stop();" class="quicktime_pause_btn"></a>
    </div>

<div>
    <img src="images/quicktime_logo.gif" width="32" height="30" alt="Quicktime" border="0" align="left" />
    <a href="javascript:document.movie1.Play();" class="quicktime_play_btn"></a>
    <a href="javascript:document.movie1.Stop();" class="quicktime_pause_btn"></a>
    </div>

and my JQuery looks like..

 var $ab = jQuery.noConflict();
              $ab(document).ready(function() {
                    $ab(".quicktime_play_btn").click(function() {
              $ab(this).hide();
              $ab(".quicktime_pause_btn").css("display", "block");
});         

                    $ab(".quicktime_pause_btn").click(function() {
              $ab(this).hide();
              $ab(".quicktime_play_btn").show();
});     
                });
  • 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-30T23:16:05+00:00Added an answer on May 30, 2026 at 11:16 pm

    Use the parent function of jQuery:

    Instead of:

    $ab('this').hide();
    $ab(".quicktime_pause_btn").css("display", "block");
    

    Use:

    $ab('this').hide().parent().find(".quicktime_pause_btn").css("display", "block");
    

    By that, you get the div container (parent) and look inside of that for the class “quicktime_pause_btn”

    Alternatively, use the closest function:

    $ab('this').hide().closest('div').find(".quicktime_pause_btn").css("display", "block");
    

    Same approach …

    Or with next/prev:

    $ab('this').hide().next().show();
    

    Vice versa with your second button.

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

Sidebar

Related Questions

I have an application which will support several standard operations play stop pause undo
I am developing a soundboard application which extends ListActivity. I have a play button
Lots of keyboards have common media functions like next/previous, play/pause and stop. Do they
I have for example a Play/Pause button and would like its size not to
A player: http://www.yvoschaap.com/videowall/ How can you customise the above Chromeless Youtube to have Play/Stop/Pause
I have an mp3 player that sends MCI commands to play pause/ff/rw/stop the audio
i have created two UIButtons and only play button is appearing on the UIToolbar.
I have an app containing three buttons , play , pause and stop .
I have an application which uses the MediaPlayer to play music. When I play
I have a toolbar, which is next to a slider (screenshot: http://i54.tinypic.com/w2n6ag.jpg ) 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.