Last active
December 12, 2015 07:09
-
-
Save dcs619/4734665 to your computer and use it in GitHub Desktop.
Javascript function to toggle div dispaly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| $(document).ready(function () { | |
| var checkboxChange = function () { | |
| $(this).parent().next('div').toggle(); | |
| } | |
| $('.togglePanel').on('change', checkboxChange); | |
| }); | |
| </script> | |
| //////// within markup | |
| <label class="checkbox"> | |
| <input type="checkbox" class="togglePanel" id="cbxCreateAcct" /> Save My Information | |
| </label> | |
| <div id="grpCreateAcct" style="display: none"> | |
| ... elements | |
| </div> | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added one-time click event:
onclick="javascript: $('#grpCreateAcct').toggle()"