Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
423 B
1
Indexable
Never
from IPython.display import HTML, Javascript

def toggle_content(content):
    display(HTML("<div id='toggle'>" + content + "</div>"))
    display(Javascript("""
    var el = document.getElementById('#toggle');
    el.onclick = function () {
        if (el.style.visibility == 'hidden') {
            el.style.visibility = 'visible';
        } else {
            el.style.visiblity = 'hidden';
        }    
    }
    """))