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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:18:32+00:00 2026-06-06T01:18:32+00:00

Here is the JS Fiddle . I would like the content to be somewhat

  • 0

Here is the JS Fiddle. I would like the content to be somewhat interactive, and just click the content to hide it. To allow the user to bring it back if s/he would like to, the hidden portion appears in the <aside> section to the right. I have the ‘header’ (Business Approach) working as it must remain as a Parent DOM element. I have been struggling getting the children to work. My current attempt for the children is/are this (also posted on the fiddle):

    //individual BA elements Toggle Buttons
    //Currently on, turning Off
        $('.block > .businessapproaches > section > input').on('change', function () {
            if (this.checked) {
            } else {
                var index = $(this).prevAll('section').length;
                $('.block > .businessapproaches > section').eq(index).hide();
                $('fieldset.businessapproaches > label').eq(index+1).show();
                $('fieldset.businessapproaches > input').eq(index+1).prop('checked' , false);
                console.log("off")
                console.log("left index: " + index);
                console.log($('.block > .businessapproaches > section').eq(index));
                console.log($('fieldset.businessapproaches > label').eq(index+1));
            }
        });
    //Currently off, turning On
        $('fieldset.businessapproaches > input').on('change', function () {
            if (this.checked) {
            } else {
                var index = $(this).prevAll('section').length+1;
                $('.block > .businessapproaches > section').eq(index-1).show();
                $('.block > .businessapproaches > input').eq(index-1).prop('checked' , false);
                $('fieldset.businessapproaches > label').eq(index).hide();
                console.log("on")
                console.log("right index: " + index);
                console.log($('.block > .businessapproaches > section').eq(index-1));
                console.log($('fieldset.businessapproaches > label').eq(index));
            }
        });

Sorry to post 2 questions in the same stack, but it seems relevant, and I’m trying quickly to get to a rep of 125 so I can post multiple questions without having to wait the prescribed time)

BONUS POINTS: Can tell me why the ‘header’ (Business Approach) is clickable by either the checkbox or the text, while the children are not? Where is my error, as I will eventually hide the ‘boxes’ with css.

  • 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-06T01:18:33+00:00Added an answer on June 6, 2026 at 1:18 am

    I tried in fiddle http://fiddle.jshell.net/guanxiaohua2k6/dpvAn/1/. I think it worked as you want.

    I will show where to modify below.

    @@ -10 +10 @@
    -                    var index = $(this).prevAll('section').length;
    +                    var index = $(this).closest('section').prevAll('section').length;
    @@ -13 +13 @@
    -                    $('fieldset.businessapproaches > input').eq(index+1).prop('checked' ,     false);
    +                    $('fieldset.businessapproaches > input').eq(index+1).prop('checked' , true);
    @@ -24 +24 @@
    -                    var index = $(this).prevAll('section').length+1;
    +                    var index = $(this).prevAll('input').length;
    @@ -26 +26 @@
    -                    $('.block > .businessapproaches > input').eq(index-1).prop('checked' , false);
    +                    $('.block > .businessapproaches > section > input').eq(index-1).prop('checked' , true);
    

    As to why the ‘header’ of children couldn’t be clicked, the inputs’ ids are duplicated with ones in <aside>.

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

Sidebar

Related Questions

Here is my Fiddle: http://jsfiddle.net/LLFpp/ I'm just starting to learn CSS and Divs (moving
Here is my fiddle: http://jsfiddle.net/jamesbrighton/wxWgG/4/ HTML: <div> <p class=click>Click 1</p> <p>This should be ignored</p>
I would like to implement several Modals instead of just 1. I've run into
Please see the fiddle ( http://jsfiddle.net/Jk6Bk/5/ ) I would like to add some spacing
I have a fiddle here - http://jsfiddle.net/hhimanshu/SDr3F/2/ The left pane is already available I
I have a fiddle here http://jsfiddle.net/WULsZ/1/ I load jQuery first and the code is
Here's my fiddle: http://jsfiddle.net/e6kCH/15/ It may sound stupid, but I can't find a way
Here's my fiddle : http://jsfiddle.net/JWww3/ I'm not sure to understand why this code is
Here is a fiddle with it centered, but the image with position:relative instead of
Here is the fiddle: fiddle Basically I want to include and accordion menu using

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.