-
-
Save FinanceData/9ccb953716e26b0d091dc35bacefd018 to your computer and use it in GitHub Desktop.
Code toggle button for IPython notebook
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
'''Creates a button to toggle code inputs on and off.''' | |
from IPython.core.display import display_html | |
di.display_html(''' | |
<script> | |
'use strict'; | |
function code_toggle() { | |
let code = $('div.input'); | |
code.css('display') == 'none' ? code.show() : code.hide(); | |
} | |
$(document).ready(function() { | |
$('div.input').hide(); | |
}); | |
</script> | |
''', raw=True) | |
di.display_html('<button onclick="code_toggle()">Toggle Code</button>', raw=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment