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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:38:44+00:00 2026-06-18T03:38:44+00:00

I am using jquery to show/hide more info when a user selects a radio

  • 0

I am using jquery to show/hide more info when a user selects a radio option. It’s a simple concept – when the user clicks within the < dt > tag (i.e., they click either the < input > or < label >) the < dd > slides and stays open to display more information. Clicking within the < dt > tag again closes the < dd >.

I’ve successfully used this show/hide script in the past, but never with the inclusion of input or label tags. By adding a label with the for= parameter, I get issues:

If you click the radio , the slide opens fine and remains open, but click the label area and the slide opens and immediately bounces closed. In trying to debug, I found if i change or remove the for= to not match the correct id of the radio button (e.g., < input type=”radio” id=”option01″ > < label for=”” >), the slide will no longer bounce open to closed, but alas, then I’d be sacrificing accessibility by removing the for=.

Any thoughts on keeping this structure, or close to it, and not dealing with the bounce close effect?

$(document).ready(function() {
   $('.serviceOption').find('dd').hide().end().find('dt').click(function() {
    var moreInfo = $(this).next();
    if (moreInfo.is(':visible')) {
        moreInfo.slideUp();
    } else {
        moreInfo.slideDown('slow');
    }
   });
});

<dl class="serviceOption">  
    <dt>
        <input type="radio" name="serviceOptions" id="option01" value="value01">
        <label for="option01">Option 1</label>
    </dt>  
    <dd>Show more information on Option 1</dd>
    <dt>
        <input type="radio" name="serviceOptions" id="option02" value="value02">
        <label for="option02">Option 2</label>
    </dt>
    <dd>Show more information on Option 2</dd>
</dl>

Here’s an example jsFiddle….

http://jsfiddle.net/8JjvT/

Clicking the radio buttons opens and closes the dd correctly. Try clicking the labels to see the problem. It opens and closes immediately.

  • 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-18T03:38:45+00:00Added an answer on June 18, 2026 at 3:38 am

    Ok, I stand corrected: apparently, labels with for= do have issues with click events!

    See this answer: jQuery Click fires twice when clicking on label

    Now, taking that into account, we have to make a decision… the only way I could get it to work properly was to bind the click event to the input field, not the dt.

    Here’s my Fiddle: http://jsfiddle.net/mori57/X9pNY/

    // get all the input items from the dt's
    var terms = $(".serviceOption dt input");
    // attach a click handler, pass in the event
    terms.click(function (evt) {
        // store the clicked item's closest dt
        var clickedDT = $(this).closest("dt");
        // if there are visible dd's
        if ($("dd:visible").length > 0) {
            // hide them
            $("dd:visible").slideUp(400, function () {
                // May not need to put this inside the callback, 
                // now that I know it was label's fault
                $(clickedDT).next("dd").slideDown();
            });
        } else {
            // otherwise, just show the nearest dd
            $(clickedDT).next("dd").slideDown();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jQuery(document).ready(function(){ $(#red-products).hide(); $(#content-info).click(function(event){ $(#red-products).hide(); $(#red-information).show(); }); $(#content-product).click(function(event){ $(#red-information).hide(); $(#red-products).show(); }); $(#more).click(function(event){ load(this.href); return false;
I am using jQuery to show/hide a div container (#pluginOptionsContainer), and load a page
I am encountering an odd behavior using jQuery to show/hide a menu. I have
As the title implies, I'm using jQuery's show and hide functions to hide and
all I want to show hide some ids using jQuery. My html code is
I'm using this jquery code to show and hide divs on my page. As
How to I hide and show HTML elements using JQuery without any special effects?
I have some DIVs that I am using JQuery to hide and show using
I am using jQuery to show or hide a span. But I want the
I am using below jQuery code to show/hide extra text on my web page

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.