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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:53:19+00:00 2026-05-22T17:53:19+00:00

How do I hide a form and display it when a label is clicked?

  • 0

How do I hide a form and display it when a label is clicked?

<form id="form1" action="javascript:return true;" name="form1">
<input type="radio" name="group1" value="opt1" id="opt1" 
onclick="show()"><label for="opt1">Option 1</label><br>
<input type="radio" name="group1" value="opt2" id="opt2" 
onclick="show()"><label for="opt2">Option 2</label><br>
<input type="radio" name="group1" value="opt3" id="opt3" 
onclick="show()"><label for="opt3">Option 3</label><br>

<div id="droplist">
<select name="opt2-select">
<option value='opt2a'>Option 2A</option>
<option value='opt2b'>Option 2B</option>
<option value='opt2c'>Option 2C</option>
</select>
</div>
</form>

<label id="a" onclick="formenable()">click</label>....

function formenable()
{
var o=document.getElementById("form1");
o.style.visibility="hidden"
}

First the form should be hidden default. When the label is clicked the form should be displayed. How do I do that?

  • 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-22T17:53:20+00:00Added an answer on May 22, 2026 at 5:53 pm
    <form id="form1" action="javascript:return true;" name="form1" style="display:none">
    

    <script>
    function cl(obj) {
       div = document.getElementById(obj.id + 'div');
       div.style.display = (div.style.display == 'block') ? 'none' : 'block';
    }
    </script>
    
    <label id="browser" onclick="cl(this)">Browser</label>
    
    <div id="browserdiv" style="display: none">
        Browser stuff goes here
    
        <label id="os" onclick="cl(this)">OS</label>
    
        <div id="osdiv" style="display: none">
           OS stuff goes here
        </div>
    
    </div>
    

    With this, when you click on the Browser label, all of the ‘os’ still will appear/disappear, without having to do any extra hiding/showing. Probably not exactly what you want, but should get you started.

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

Sidebar

Related Questions

This is my html form I am using. <label>Your Username:</label><input id=username name=username type=text onchange=return
How can I show and hide the following DIVs when radio button clicked? <form
<div style=display:none> <form id=login_form method=post action=> <p id=login_error>Please, enter data</p> <p> <label for=login_name>Login: </label>
I have the existing code: <form action=page.php?id=<?= $_GET['id'] ?> method=post> <fieldset> <p id=edit_name><label for=name>Page
This is a form validation that will hide the submit button if the input
Javascript I have code that will hide various sections in a MS CRM form
I have two radio buttons on my MVC form that I use to hide
I'm trying to display a reply form for each comment but I hide the
I have a simple email form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up
I am trying to use javascript to display or hide a section of a

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.