Skip to content

Instantly share code, notes, and snippets.

@thomasbennett
Last active October 24, 2017 17:12
Show Gist options
  • Save thomasbennett/302195bdda5a2509fdb6e0a20968ca56 to your computer and use it in GitHub Desktop.
Save thomasbennett/302195bdda5a2509fdb6e0a20968ca56 to your computer and use it in GitHub Desktop.
Show / Hide an element with Bootstrap
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#button-id-here').on('click', function() {
jQuery('#form-id-here').toggleClass('hidden');
});
});
</script>
<button id="button-id-here">Click Me</button>
<form id="form-id-here" class="hidden">
<!-- whatever -->
</form>
@thomasbennett
Copy link
Author

The ID on the button and the form should match the IDs in the JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment