I'm trying to make a button that shows a paragraph on click and hides it on a second click. Instead of using a more traditional method, I went with using JavaScript to change the style from visibility:hidden
to visibilitiy:visible
.
<style>
#p {
visibility:hidden;
}
</style>
<button onclick="show() ">Click me</button>
<p id="p">hi</p>
<script>
function show() {
document.getElementById("p").style.visibility = "visible";
}
</script>
How can I do this without jQuery?