/ Published in: jQuery

A little snippet that I use to hide or show text using jquery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
URL: http://jsfiddle.net/TwistedEinstein/eGfgC/1/
Comments
