+ Post New Thread
Results 1 to 2 of 2

Thread: Javascript - click to hide/show text/content

  1. #1
    Fli
    Fli is online now
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,498

    Javascript - click to hide/show text/content



    Hello, do You know any effective and simple javascript code which allows showing/hiding some webpage content on click?

    so far i found this one:
    Code:
    <script>
    function showhide(idecko){
    el=document.getElementById(idecko).style; 
    el.display=(el.display == 'block')?'none':'block';
    }
    </script>
    <style>.hidden {display: none}</style>
    <span style="cursor: pointer; cursor: hand;" onclick="showhide('oddil1')">Click me to show/hide</span>
    <div id="oddil1" class="hidden">Hidden text here</div>
    and it works. By default, text is hidden, when one click it is shown, when click again, it is hidden

  2. #2
    Junior Member NancyHolmes's Avatar
    Join Date
    Jul 2019
    Location
    California
    Posts
    25
    I suggest you to Google free code camp .
    This will definitely help you.

+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 12-18-2015, 01:08 PM
  2. Replies: 0
    Last Post: 09-09-2015, 12:32 PM
  3. Replies: 0
    Last Post: 12-04-2014, 06:00 PM
  4. Replies: 0
    Last Post: 11-14-2014, 01:48 AM
  5. Replies: 0
    Last Post: 11-12-2014, 03:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam