Created
May 9, 2016 18:08
-
-
Save simeonf/aceb8c3b3fea7e443a16d95336d57f73 to your computer and use it in GitHub Desktop.
First cell in my IPython Notebook to add hidden cells with a "Show" button.
This file contains 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
# hideme | |
import IPython.core.display as di | |
di.display_html("""<script>$(function() { | |
$("div.code_cell:contains('hideme')").hide(); | |
$("div.code_cell:contains('showme')").hide(); | |
$(".showme").remove(); | |
$("div.code_cell:contains('showme')").before('<button class="showme">Show Answer</button>'); | |
$(".showme").click(function(){$(this).next().show();}); | |
});</script>""", raw=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment