Javascript toggle content - roScripts


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <a href='javascript: toggle()'>toggle</a> <div id='div1' style='display:none'> Don't display me </div> <script>
  2.  
  3. function toggle(){ var div1 = document.getElementById('div1') if (div1.style.display == 'none') { div1.style.display = 'block' } else { div1.style.display = 'none' } } </script>

URL: http://www.roscripts.com/snippets/show/144

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.