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

  • Home
  • SEARCH
  • 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 6194343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:16:49+00:00 2026-05-24T03:16:49+00:00

How can I achieve this dynamically using JavaScript? onselect radio button 1: Shows div

  • 0

How can I achieve this dynamically using JavaScript?

onselect radio button 1: Shows div 1,2,5, hides (if not already hidden) divs 3,4,6,7

onselect radio button 2: Shows div 3,4,6,7, hides (if not already hidden) divs 1,2,5

<input type="radio" id="button-1" name="button" />Button 1
<input type="radio" id="button-2" name="button" />Button 2

<div id="div-1"></div>
<div id="div-2"></div>
<div id="div-3"></div>
<div id="div-4"></div>
<div id="div-5"></div>
<div id="div-6"></div>
<div id="div-7"></div>

edit I formulated my question poorly, will formulate it better when at home after work..

  • 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-24T03:16:50+00:00Added an answer on May 24, 2026 at 3:16 am

    To make it easier on yourself, add a class to the two groups of radio buttons, something like divGroup1, divGroup2

        <div class="divGroup1" id="div-1"></div>
        <div class="divGroup1" id="div-2"></div>
        <div class="divGroup2" id="div-3"></div>
        <div class="divGroup2" id="div-4"></div>
        <div class="divGroup1" id="div-5"></div>
        <div class="divGroup2" id="div-6"></div>
        <div class="divGroup2" id="div-7"></div>
    

    then in jQuery, do something like this:

    $("#button-1").click(function()
    {
        $(".divGroup1").show();
        $(".divGroup2").hide();
    });
    
    $("#button-2").click(function()
    {
        $(".divGroup2").show();
        $(".divGroup1").hide();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using plain old HTML, how can I achieve a layout like this? I've got
In PHP and in JavaScript you can dynamically use a variable by using another
Anyone know of a control for asp.net that can achieve this either server or
As title; is there any function that can achieve this?
How can I achieve this? I am trying to load content from the database
How can I achieve this behaviors onclick with jquery : default state: <a href=something.html>Anchor</a>
Can't seem to achieve this simple functionality! All I want is to clear a
I hope this I can explain what I am trying to achieve: I want
how can i dynamically display my images coming from database? I'll be using a
How do i obtain aero glass box effect using css. My user can dynamically

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.