Javascript toggle show/hide div or anything

You would manipulate the elements by toggling between styling rather than changing the elements based on the innerHTML. In this case, you would toggle between display:none and display:block.


<script type="text/javascript">
    function show_hide(id) {
       var elt = document.getElementById(id);
       if(elt .style.display == 'block'){
          elt .style.display = 'none';
          elt .style.display = 'block';

By Keenlio, October 14, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

eight + 7 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>