Skip to content

Instantly share code, notes, and snippets.

@chbrandt
Created January 30, 2018 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chbrandt/252ab0d446264e871fa82223cf2978e7 to your computer and use it in GitHub Desktop.
Save chbrandt/252ab0d446264e871fa82223cf2978e7 to your computer and use it in GitHub Desktop.
Jupyter notebook toggle code-cells on/off
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Toggle code on/off"></form>''')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment