www.webdeveloper.com
Results 1 to 3 of 3

Thread: Hide & Display Content With Javascript

Hybrid View

  1. #1
    Join Date
    Mar 2014
    Posts
    4

    Arrow Hide & Display Content With Javascript

    I want to hide something on my website & show it with javascript. Like this:
    ''Click Here For Options'' Then when you click the link the options tab opens up...

    I found this code it works, but the content IS SHOWN by default, then when you click the link it hides it:

    Code:
     <a href="javascript:hideshow(document.getElementById('adiv'))">Click Here For Options</a>
    
    <script type="text/javascript">
    function hideshow(which){
    if (!document.getElementById)
    return
    if (which.style.display=="block")
    which.style.display="none"
    else
    which.style.display="block"
    }
    </script>
    
    <div id="adiv" style="font:24px bold; display: block">my code to display the options</div>
    Does anyone know how i can make this the other way round & hide the content by default then display it when i click the link?

  2. #2
    Join Date
    Oct 2013
    Posts
    404
    Code:
    <div id="adiv" style="font:24px bold; display: none">my code to display the options</div>

  3. #3
    Join Date
    Mar 2014
    Posts
    4
    Thanks a million m8, i've been scratching my head for hours...

    Solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles