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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:46:51+00:00 2026-05-18T04:46:51+00:00

I have two radio buttons that are YES (value=1) and NO (value=0), I’m using

  • 0

I have two radio buttons that are YES (value=1) and NO (value=0), I’m using the following code to show a hidden division when you click on YES:

     $("#regaddress").change(function(){
    if ($(this).val() == "1" ) {
        $("#registeredaddress").slideDown("fast"); //Slide Down Effect
    } else {
        $("#registeredaddress").slideUp("fast");    //Slide Up Effect
    }
});

Code for Radio Buttons:

<input name="regaddress" id="regaddress" type="radio" value="1">Yes
<input name="regaddress" id="regaddress" type="radio" value="0" checked> No 

What I need is the code to hide that division when you click NO. Should be a simple answer for some of you, but personally feel like banging my head against a wall this afternoon trying to work out how to hide it!

  • 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-18T04:46:52+00:00Added an answer on May 18, 2026 at 4:46 am

    That’s easy enough, because you posted no id or name attributes in your original question, I’ve abstracted it out to the following:

    html

    <form action="" method="post">
        <fieldset>
            <input type="radio" value="0" name="state" id="no" />
            <label for="no">No</label>
            <input type="radio" value="1" name="state" id="yes" />
            <label for="yes">Yes</label>
        </fieldset>
    </form>
    <div id="hidden">This div is hidden</div>
    

    jQuery

    $(document).ready(
        function(){
            $('input:radio[name=state]').change(
                function(){
                    if ($(this).val()==1) {
                        $('#hidden').show();
                    }
                    else {
                        $('#hidden').hide();
                    }
                }
                );
        });
    

    Demo of the above posted at JS Fiddle.

    Amended slightly to take into account the slideUp() and slideDown() usage:

    $(document).ready(
        function(){
            $('input:radio[name=state]').change(
                function(){
                    if ($(this).val()==1) {
                        $('#hidden').slideDown(1000).text('This div is no longer hidden.');
                    }
                    else {
                        $('#hidden').slideUp(1000).text('This div is now hidden.');
                    }
                }
                );
        });
    

    Demo at JS Fiddle.


    Final edit to take into account your id and name attributes:

    $(document).ready(
        function(){
            $('input:radio[name=regaddress]').change(
                function(){
                    if ($(this).val()==1) {
                        $('#registeredaddress').slideDown(1000).text('This div is no longer hidden.');
                    }
                    else {
                        $('#registeredaddress').slideUp(1000).text('This div is now hidden.');
                    }
                }
                );
        });
    

    Demo at JS Fiddle

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

Sidebar

Related Questions

I have a form with two radio buttons, Yes and No, that toggles visibility
I have two radio buttons on my MVC form that I use to hide
I have two radio buttons, to which I have assigned change handlers to show/hide
I am using jQuery to customize some radio buttons. I have two different radio
I have a contact form with two radio buttons. But I need to show
I have two radio buttons that are disabled with javascript when the page loads.
I have two radio buttons with the same name. Using JavaScript, how can I
I have two radio buttons what I want is that when I select one
I have two forms, one with a radio button that users must select to
I have two radio buttons next to each other, and even though each one

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.