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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:46:48+00:00 2026-05-23T19:46:48+00:00

I have this markup: <span id=tabPhp class=infoData>PHP</span> <span id=tabJquery class=infoData>jQuery</span> <span id=tabWordPress class=infoData>WordPress</span> <span

  • 0

I have this markup:

        <span id="tabPhp" class="infoData">PHP</span>
        <span id="tabJquery" class="infoData">jQuery</span>
        <span id="tabWordpress" class="infoData">WordPress</span>
        <span id="tabCss3" class="infoData">CSS3</span>
        <span id="tabMysql" class="infoData">MySQL</span>
        <div class="infoExpand">
            <p id="infoPhp">PHP</p>
            <p id="infoJquery">jQuery</p>
            <p id="infoWordpress">Wordpress</p>
            <p id="infoCss3">CSS3</p>
            <p id="infoMysql">MySQL</p>
        </div>

And this jQuery:

$('.infoData').click(function(){
    $('.infoExpand p').hide();
    var id = this.id;
    id = id.replace("tab", "info");
    console.log(id);
    $('.infoExpand, #' + id).slideToggle();
});

By default div infoExpand is set to display:none so what i want to happen is, when the user clicks span id tabPHP, infoExpand slides down along with p id infoPhp. This works fine but when the user hits another tab, it just slides the currently shown p. I want it to slide up the current one and slide down the one they have clicked.

Does that make sense?

Thanks

  • 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-23T19:46:48+00:00Added an answer on May 23, 2026 at 7:46 pm

    You could do (UPDATED):

    $('.infoExpand p').hide();
    $('.infoData').click(function(){
        var id = this.id;
        id = id.replace("tab", "info");
        var clicked = $('.infoExpand #' + id);
        if (clicked.is(':visible')){
           clicked.slideToggle();
        }else{
           $('.infoExpand p:visible').slideToggle();
             clicked.slideToggle();
        }
    
    });
    

    fiddle here: http://jsfiddle.net/35MfY/1/

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

Sidebar

Related Questions

I have this markup x 3: <div class=features> <span class=overlay><img src=img/webdesign.png /></span> <h2>Web Design</h2>
I have this markup, <a href=http://www.example.com>Hiya<span class=delete>Delete</span></a> And my js, $('.delete').click(function() { window.location =
I have some markup that looks like this: <a href=# class=someButton> <span class=play>play</span> </a>
Suppose I have this html markup: <div id=wrapper> <pre class=highlight> $(function(){ // hide all
I have some markup like this: <p><a id=1 href=#>Link 1</a></p> <p id=1show class=starthidden>Hi! I
I currently have the following HTML markup: <td class=title> <img src=my-image.png class=thumbnail /> <span
I have a horizontal menu. The markup looks like this: <ul class=menu> <li>Item 1</li>
I have the following markup: <button class=button type=button><span>Edit</span></button> I want to have a click
I have some message elements like this... <span class=error message>Whoops! Don't forget your name.</span>
I have the following HTML markup : <a class=link1 href=javascript:load(0,1);>Click here</a><span class=loader></span> The load

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.