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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:22:03+00:00 2026-05-17T16:22:03+00:00

I have a question about selecting selectboxes with Javascript. I have upload the files

  • 0

I have a question about selecting selectboxes with Javascript. I have upload the files on http://www.mikevierwind.nl/javascript/risicoinventarisatie.htm Here you see a table with a lot of questions and radiobuttons. Every question have 2 radiobuttons, yes and no.

When you go to the first question. “Diabetes” Than you choose for the radiobutton “ja” You see that another question will now show. But when I choose for “nee” than the question must be gone. How can I create that with the Javascript? My Javascript code is:

 var diabetes = false;
 var diabetesvraag = $("#blokken table.lichamelijkegezondheid .diabetesextra")
 var buttondiabetes = $("#blokken table.lichamelijkegezondheid .diabetesja")

 diabetesvraag.hide();
 buttondiabetes.click(function()
 {   
  if(diabetes == false)
  {
   diabetes = true;
   diabetesvraag.show();
  }

  else
  {
   diabetes = false;
   diabetesvraag.hide();
  }
  return false;
 }); 
  • 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-17T16:22:03+00:00Added an answer on May 17, 2026 at 4:22 pm

    Well, first of all you need to get your HTML corrected. Each set of “yes” and “no” radiobuttons need to be grouped together with the correct name attribute. This will tell the browser that only one of each set of “yes” and “no” is selectable. The name must be unique for each condition, however. Something like this should do:

    <span class="radio">
        <input type="radio" name="condition_selection" value="yes" id="yes" />
        <label for="yes">Yes</label>
        <input type="radio" name="condition_selection" value="no" id="no" />
        <label for="no">No</label></span>
    

    You should also use the for attribute for the label element for accessibility reasons, and try using something else other than tables for marking up this form, but that’s not relevant to the question here.


    Next, you can try simplifying the Javascript code using the change event handler to check for both states, with something like this:

    $('.add_qns').hide();
    
    $('.radio :radio').change(function(){
        if(this.value === 'yes'){
            $(this).parent().next('.add_qns').show();
        } else {
            $(this).parent().next('.add_qns').hide();
        }
    });
    

    You have the change the selector $(this).parent().next('.add_qns') to suit your markup. See: http://www.jsfiddle.net/yijiang/BcAwH/ for a live demo.

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

Sidebar

Related Questions

I have a jquery question about selecting Id. Basically, I call a javascript function
I have some question about XML columns: when we selecting a XML column and
I have been reading on the different question talking about selecting unique nodes in
I have a basic question about selecting counts: If I have a table ContentTable
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,
i have question about YAJLiOS parser... I have next json data : {{ body

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.