Posted By

TwistedEinstein on 07/16/13


Tagged

show html hide jquery text using


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Priestd09
qing606


Hide/Show text using jQuery


 / Published in: jQuery
 

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

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

  1. <div id="extra">This is could be a hidden form</div>
  2. <input type="checkbox" id="checkme" />
  3. <label>Click me</label>
  4.  
  5. <script>
  6. $(document).ready(function () {
  7.  
  8. //Hide div w/id extra
  9. $("#extra").css("display", "none");
  10.  
  11. // Add onclick handler to checkbox w/id checkme
  12. $("#checkme").click(function () {
  13.  
  14. // If checked
  15. if ($("#checkme").is(":checked")) {
  16. //show the hidden div
  17. $("#extra").show("fast");
  18. } else {
  19. //otherwise, hide it
  20. $("#extra").hide("fast");
  21. }
  22. });
  23.  
  24. });
  25. </script>

Report this snippet  

You need to login to post a comment.