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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:29:24+00:00 2026-06-07T03:29:24+00:00

So I have two sections, a fieldset panel div , and a generated content

  • 0

So I have two sections, a fieldset panel div, and a “generated content” div. I am “moving” elements from one to another by hiding them on change from one section and unhiding them in the other section. For one particular section “Abstract”, which has a class .abstract and several elements all having the class oneseven, how do I change the width attribute of the sections based on how many are hidden?

Here is my code:

// Abstract
//hide initially
    $('fieldset.abstract label').hide();
//individual Abstract elements Toggle Buttons
    //Currently on, turning Off
        $('.block > .abstract > .superseven > section > .oneseven > input').on('change', function () {
            var hidden = 0;
            var width = Number((1/(7-hidden))*100);
            if (this.checked) {
            } else {
                var hidden = ($('.block > .abstract > .superseven > section > :hidden').length + 1);
                var width = Number((1/(7-hidden))*100);
                console.log(hidden);
                console.log('"' + Number(width) + '%"');
/*issue here*/      $('.oneseven').css("width", '"' + Number(width) + '%"');
                var index = $(this).closest('section').prevAll('section').length;
                $('.block > .abstract > .superseven > section').eq(index).hide("slow");
                $('fieldset.abstract > label').eq(index+1).show("slow");
                $('fieldset.abstract > input').eq(index+1).prop('checked' , true);
            }
        });
    //Currently off, turning On
        $('fieldset.abstract > input').on('change', function () {
            var hidden = 0;
            var width = Number((1/(7-hidden))*100);
            if (this.checked) {
            } else {
                var hidden = ($('.block > .abstract > .superseven > section > :hidden').length - 1);
                var width = Number((1/(7-hidden))*100);
                console.log(hidden);
                console.log('"' + Number(width) + '%"');
/*and here*/        $('.oneseven').css("width", '"' + Number(width) + '%"');
                var index = $(this).prevAll('input').length;
                $('.block > .abstract > .superseven > section').eq(index-1).show("slow");
                $('.block > .abstract > .superseven > section > .oneseven > input').eq(index-1).prop('checked' , true);
                $('fieldset.abstract > label').eq(index).hide("slow");
            }
        });

I can accomplish this in the console by typing $('.oneseven').css("width", "33.33%");
or changing the numeric value to 25% or 20%, etc…m but getting it in the JS section isn’t working.

I have tried:

  • type casting it into an int using parseInt()
  • changing it to a Number using JS (current code)
  • entering everything with the width actually in number format in the console and it works

I think it is somewhere in the second parameter for the css attribute Jquery selector. How do I fixit?
Notes

I have the vars hidden and width twice, because I am not sure if they need to be global or not to solve this problem. I am trying to get it to work, then I can troubleshoot and see what scope is needed.

  • 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-07T03:29:27+00:00Added an answer on June 7, 2026 at 3:29 am

    Yes, @pimvdb is correct, for some reason, the nested quotes are not needed, so the final line of code is
    $('.oneseven').css("width", (width) + "%");

    and the Number() type casting/conversions were not needed.

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

Sidebar

Related Questions

I have two tables in my application. The first one, Sections, stores content for
I have two sections next to eachother- one is for recent work, the other
In my 'Sectioned' UITableView I have two sections, the first one for Attributes like
I have an instance of UITableView with two sections, the first with one row
I have a FlowDocument with two Sections. One is named 'Inhalt'. Trying to replace
Can any one help me please, I have two sections of my question. What
I have a UITableView With Two Sections. First section has one row and the
I have one problem with two sections in UITableview grouped style. First section having
I have two sections on my PHP form. One section allows to enter Customer
I am developing an ipad app.In this app,I have two sections-one showing a Gallery

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.