Hide or Show javascript part 2 : getElementById

Posted under » JavaScript on 11 November 2009

I hope you have read the version one of hide and show. This is the more practical usage especially if you have more than one things to hide and show. The neat thing is that you can toggle between hide and show using the same button.

Put this on your header.


Then put your text on the body of the HTML like so. Don't forget to put the id.

Dr. Jeremy

more »

Professor Ted Hupp

more »

You can see it in action here.

You can also show and hide using a checkbox instead of a link with the "onchange" or "onclick" tag.

<input name="market" type="checkbox" value="Yes" onchange="javascript:toggle2('speaker2','more2');" /> 

 

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data