Return to Snippet

Revision: 64219
at July 16, 2013 05:52 by TwistedEinstein


Initial Code
<div id="extra">This is could be a hidden form</div>
<input type="checkbox" id="checkme" />
<label>Click me</label>

<script>
$(document).ready(function () {

    //Hide div w/id extra
    $("#extra").css("display", "none");

    // Add onclick handler to checkbox w/id checkme
    $("#checkme").click(function () {

        // If checked
        if ($("#checkme").is(":checked")) {
            //show the hidden div
            $("#extra").show("fast");
        } else {
            //otherwise, hide it
            $("#extra").hide("fast");
        }
    });

});
</script>

Initial URL
http://jsfiddle.net/TwistedEinstein/eGfgC/1/

Initial Description
A little snippet that I use to hide or show text using jquery

Initial Title
Hide/Show text using jQuery

Initial Tags
html, jquery, text

Initial Language
jQuery