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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:47:38+00:00 2026-05-27T03:47:38+00:00

I am having 3 radio buttons approved and rejected and 4 text fields and

  • 0

I am having 3 radio buttons approved and rejected and 4 text fields and text boxes..

If i am clicking r1, all the text field and text boxes should be hided. but if i am clicking r2 and r3 the text field and text box should be displayed..

This is the code which i have used

if(approved.checked == true) {

  reason.style.visibility="hidden";

  Reason.style.visibility="hidden";
  sanction.style.visibility="display";
  sanctioned.style.visibility="display";
}

if(rejected.checked == true) {
    reason.disabled =false;
  reason.style.display="none";
  Reason.style.display="none";
  sanction.style.visibility="hidden";
  sanctioned.style.visibility="hidden";
}

This code is working for the first time when i click those radio buttons. But if am clicking rejected and then clicking approved it is not working.

  • 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-27T03:47:39+00:00Added an answer on May 27, 2026 at 3:47 am

    Don’t mix the display and visibility properties, use one or the other. Valid values for the display property are: inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inherit

    Valid values for visibility are: visible | hidden | collapse | inherit

    The short answer: use visible instead of display.

    So your code can be (assuming the variables are references to suitable DOM elements):

    if(approved.checked) {
      reason.disabled = true;   // keep symetry with next loop
      reason.style.visibility = "hidden";
      Reason.style.visibility = "hidden";
      sanction.style.visibility = "visible";
      sanctioned.style.visibility = "visible";
    }
    
    if(rejected.checked) {
      reason.disabled = false;
      reason.style.visibility = "hidden";
      Reason.style.visibility  = "hidden";
      sanction.style.visibility = "hidden";
      sanctioned.style.visibility = "hidden";
    }
    

    Note that it is simpler to hide the form controls by putting them inside another element (say a div) and hiding that. But why not just disable them? Hiding and showing them might annoy, distract or just plain confuse users.

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

Sidebar

Related Questions

I am having 3 radio buttons r1, r2 and r3 and 4 text fields
I want to check multiple radio buttons, all radio buttons having same name but
I'm having trouble with my radio buttons. I can click on all three at
I am having two radio buttons of label 'Text Mode' and 'Html Mode'. If
I have several text input fields in my page, and few radio buttons. Now
I'm having trouble with a simple radio set of two radio buttons (I don't
I'm having a problem with nested model forms that contain radio buttons, when I
I'm having a headache figuring how to retrieve the gwt Radio Buttons values in
I am having an error where my JQuery works initially upon radio click, but
Having this radio buttons in horizontal controlgroup: <div data-role=fieldcontain> <fieldset data-role=controlgroup data-type=horizontal> <legend>Geslacht:</legend> <input

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.