Show / Hide Info

Written by @ 5 June 2013

Use this to show / hide content on your webpage, users can click the Show Content link and it will be displayed, then a Hide Content link shows up at the bottom so the user can Hide it.

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.javascriptfreecode.com coded by: Kerixa Inc. -->
<script type="text/javascript" language="JavaScript"><!--
function HideContent(d) {
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
document.getElementById(d).style.display = "block";
}
function ReverseDisplay(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
  //--></script>Content Info:<br/>
<a href="javascript:ShowContent('uniquename')">
Show Content
</a>
<div id="uniquename" style="display:none;">
<p>Visit us again!</p>
<a href="javascript:HideContent('uniquename')">
Hide Content
</a>
</div><a target='_blank' href='https://www.javascriptfreecode.com' style='font-size: 8pt; text-decoration: none'>JavaScript Best Codes</a>                                                
                                            

Example:


About @

This user is pending a biography.


Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: admin_js, bloxio, yqaice, flooketsu, phuang_test
advertisement 2