I am currently using
<a href="#" onclick="document.getElementById('history').style.display='block';return(false);">
To show content labelled with “history” when I click a certain button. How do I set it so that same button hides the content? I tried adding the same code again and replacing “get” with “hide” and “return(false)” to return(true) as that seemed logical to me but when I click the button nothing happens now (perhaps I have not understood something).
What is the easiest way to have the same button show and hide content?
If you can’t use jQuery (as has already been noted), you can do the following with pure JavaScript:
Place this in a function, and pass that function to the the
onclickattribute of your element.