How to make a checkbox make a text field appear right away after clicking it with a check?

Posted on 2006-04-18
Last Modified: 2010-04-06
What I am trying to do is make a checkbox on my webpage that if you click it to put a check in the box it will have a text form appear.
Question by:lhaluska
    LVL 9

    Accepted Solution

    You can do like this:

    <input type="checkbox" onclick="document.getElementById('textToShow').style.display=(this.checked)?'':'none'"/>
    <input type="text" id="textToShow" name="textToShow" style="display:none"/>
    LVL 1

    Author Comment

    Thank you very much it works great..
    LVL 9

    Expert Comment

    Welcome :)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now