Friday , February 21 2025

JS

JS – articles, how-to-fix notes, fast solutions

Show and hide block with js

Few examples for showing a block on button click. Example 1: easy to use <script type="text/javascript"> function openlink(id){ display = document.getElementById(id).style.display; if(display=='none'){ document.getElementById(id).style.display='block'; }else{ document.getElementById(id).style.display='none'; } } </script> The block will be opened by clicking on the link: <a href="#" onclick="openlink('mylink'); return false">Open the link</a> Content will be shown when …

Read More »