Html Show/hide a DIV on click <a>
Solved
Pascal_22
Posted messages
559
Status
Member
-
jepstif -
jepstif -
Bonjour,
I would like to know if it is possible, with the help of CSS, to display and hide a DIV when clicking on a link <a href>?
How can we detect from CSS that a link has been clicked?
Thank you very much
Pascal_22
Configuration: Windows 7 / Internet Explorer 8.0
I would like to know if it is possible, with the help of CSS, to display and hide a DIV when clicking on a link <a href>?
How can we detect from CSS that a link has been clicked?
Thank you very much
Pascal_22
Configuration: Windows 7 / Internet Explorer 8.0
7 answers
-
Good evening,
Here's a very simple solution in js:
Between <head> and </head><script type="text/javascript"> function switchInfoPerso() { divInfo = document.getElementById('divacacher'); if (divInfo.style.display == 'none') divInfo.style.display = 'block'; else divInfo.style.display = 'none'; } </script>
HTML Code
<a href="javascript: switchInfoPerso();">Show the text</a>
<div id="divacacher" style="display: none;">The text that is hidden</div>
--
░░░░▒▒▒▒████ ♠ MastercroW ♠ ████▒▒▒▒░░░░