jQuery Checkbox Checked Checking


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript" src="jquery-latest.pack.js"></script>
  2. <script type="text/javascript">
  3. $(document).ready(function(){
  4.  
  5. //Hide div w/id extra
  6. $("#extra").css("display","none");
  7. // Add onclick handler to checkbox w/id checkme
  8. $("#checkme").click(function(){
  9.  
  10. // If checked
  11. if ($("#checkme").is(":checked"))
  12. {
  13. //show the hidden div
  14. $("#extra").show("fast");
  15. }
  16. else
  17. {
  18. //otherwise, hide it
  19. $("#extra").hide("fast");
  20. }
  21. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.