<head> <style> a { color: green; } </style> </head> <body> <script> function toggle(id) { var node = document.getElementById(id); node.style.display == 'none' ? node.style.display = 'block' : node.style.display = 'none'; } </script> <div style="border:2px solid red"><a onclick="toggle('first');">First</a><span id="first" style="display:none"> First Content. </span><a onclick="toggle('second');">Second</a><span id="second" style="display:none"> Second Content. </span><a onclick="toggle('third');">Third</a><span id="third" style="display:none"> Third Content.<a onclick="toggle('crashme');"> Crash Me</a><span id="crashme" style="display:none"> You win! </span></div>