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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:43:44+00:00 2026-06-08T21:43:44+00:00

I have an inline form on my webpage that is hidden by css when

  • 0

I have an inline form on my webpage that is hidden by css when the page is loaded. I also have a button to display the form. However, I want that same button to hide the form if it’s clicked again. But I can’t seem to get it working, instead when I click the inline form button the form disappears even though I never assigned a function to it.

Here’s my HTML

<button id="signup" onclick="showForm('inline')">SignUp!</button>

        <!-- hidden inline form -->
        <div id="inline">
        <h2>Register! It's free!</h2>
        <form id="register" action="#" method="post" name="register">
        <label for="email">Email:</label>
            <input id="email" class="txt" type="email" name="email" />

        <label for="password">Password:</label>
            <input id="password" class="passtxt" type="password" name="password" />

        <label for="password">Repeat Password:</label>
            <input id="password" class="passtxt" type="password" name="password" />

        <button id="registerbtn">Register</button>
        </form> 
        </div>

Here’s my JS:

function showForm(form) {

    var e = document.getElementById(form);

    if (e.style.display = 'none') 
        e.style.display = 'inline';
    else
    e.style.display = 'none';

}

When I click the signup button, the form shows. However if I click it again nothing happens. But if i click the register button in the form, it disappears. Why? and how can I fix it?

EDIT: I chose DaveHogan’s as the best answer as it was what I was looking for. But I have switched over to using JQuery instead, and if you’re reading this. You should switch too.

  • 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-06-08T21:43:46+00:00Added an answer on June 8, 2026 at 9:43 pm

    It would appear you’re not checking the equality correctly (use double equals).

    if (e.style.display == 'none') 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form: <form style=display: inline; action=/player.php method=post> <input type=hidden name=recname value='.$row['name'].'> <input
I have a bunch of partials that I want to render horizontally, using form-inline
I want to place a login inline-form in a twitter navbar. I have done
I have a form that uses ASP.NET validations. I am using some inline C#
I have this <form action=profiles.php method=POST name=SearchAdvanced id=SearchAdvanced> <a style=display: inline-block; width: 100px; font-weight:
I have an inline hidden div that I would like to open in a
I want to have 2 Foreign Keys for an Inline form in the admin.
I'm using Django and have a form with two additional inline formsets. I want
I have a web page that I created with html tags(form and table) and
I have a mobile webpage that is just a simple form with a submit

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.