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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:41:04+00:00 2026-05-18T21:41:04+00:00

LIVE CODE: http://jsfiddle.net/vy4nY/ I’m following this challenge , but I’m having some issues. I’m

  • 0

LIVE CODE: http://jsfiddle.net/vy4nY/

I’m following this challenge, but I’m having some issues. I’m trying to make the Email Address box only appear when the checkbox is clicked on. What have I done incorrectly?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <title>JavaScript Challenges</title>
    <style type="text/css">
    #emailpara {visibility:hidden;}
    </style>
  </head>
  <body>
    <form action="">
      <fieldset>

        <legend>Email subscriptions</legend>

        <p id="subscribepara">
          <label>
            <input type="checkbox" name="subscribe" id="subscribe">
            Yes! I would like to receive the occasional newsletter via email.
          </label>
        </p>

        <p id="emailpara">
          <label>
            Email Address:
            <input type="text" name="email" id="email">
          </label>
        </p>

      </fieldset>
    </form>
      <script type="text/javascript">
document.getElementById('subscribe').onclick = (document.getElementById('subscribe').checked ? (document.getElementById('emailpara').style.visibility = 'visible') : (document.getElementById('emailpara').style.visibility = 'hidden'));
      </script>
  </body>
</html>
  • 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-18T21:41:05+00:00Added an answer on May 18, 2026 at 9:41 pm

    The onclick handler should be a function. Use:

    document.getElementById('subscribe').onclick = function() {
        document.getElementById('emailpara').style.visibility = this.checked ? 'visible' : 'hidden';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Live Demo with visible code; http://jsfiddle.net/3eEgb/4/ The demo should be fairly self explanatory; I'm
I have the following code, which works fine on live site, but not on
On our live/production database I'm trying to add a trigger to a table, but
it is possible to bind Live('hover') and bind('contextmenu') on the same .class? This code
Please have a look at http://live.heritageartpapers.co.uk/catalogue.aspx and advise me on the following: Currently customers
I'm working off of some of Apple's sample code for mixing audio ( http://developer.apple.com/library/ios/#samplecode/MixerHost/Introduction/Intro.html
I am writing code to migrate data from our live Access database to a
Maybe I live in a bubble, or am just too new, but I was
I have a simple jQuery function: $('#selectable1 span').live('mousedown', function() { var ff = $(this).css(font-family);
As you can see on http://jsbin.com/erivi/ I'm using Jquery to change some image (and

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.