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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:19:34+00:00 2026-06-12T22:19:34+00:00

I need an active link added to the actual a link on this accordion..

  • 0

I need an active link added to the actual a link on this accordion.. currently it just adds one to the container which is handy too but how easy to add an active to the button linke so i can have an up or down arrow…?

<dl class="accordion">

    <dt><a href="">Panel 1</a></dt>
    <dd>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</dd>

    <dt><a href="">Panel 2</a></dt>
    <dd>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</dd>

    <dt><a href="">Panel 3</a></dt>
    <dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</dd>

    </dl>​


jQuery(document).ready(function($) {



      var allPanels = $('.accordion > dd').hide();

      $('.accordion > dt > a').click(function() {
          $this = $(this);
          $target =  $this.parent().next();

          if(!$target.hasClass('active')){
             allPanels.removeClass('active').slideUp();
             $target.addClass('active').slideDown();
          }

        return false;
      });


});

Many thanks for any help..

  • 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-12T22:19:36+00:00Added an answer on June 12, 2026 at 10:19 pm

    try this…

    jQuery(document).ready(function($) {
    var allPanels = $('.accordion > dd').hide();
    
      $('.accordion > dt > a').click(function() {
          $this = $(this);
          $target =  $this.parent().next();
    
          if(!$target.hasClass('active')){
             allPanels.removeClass('active').slideUp();
    
             $target.addClass('active').slideDown();
    
             $('.accordion > dt > a').removeClass('active'); // remove class active in <a>
             $this.addClass('active'); // add class active in clicked  <a>
    
             //or//
    
             $('.accordion > dt').removeClass('active'); // remove class active in <dt>
             $this.parent().addClass('active'); // add class active in clicked  <dt>
          }
    
        return false;
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in this example http://sorgalla.com/projects/jcarousel/examples/static_controls.html i need an active state on li so it should
I need to add .active class on active task's menu link on the page.
I need some help to set a link as active as default when the
I'm modifying an accordion script to add the class active to the link that
I need to highlight active link in the menu. My menu is in the
Having a little trouble on this one. I need a way using Jquery/JS to
I need help with switching tabs, here is the example link: http://app.seed-ville.com/357-2/#1 This is
I have tabbed iOS application. I need to know which tab is active and
I need to know active screen DPI on Linux and Mac OS. I think
I need to assign an active class to my main-level navigation rendered by wordpress.

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.