SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    show hidden text

    Hello,
    I have this code with 2 buttons to show and hide text. But i want only to show the hidden text using only 1 button.
    Can anyone help me ?

    <p id="p1">Text text text......text .</p>

    <input type="button" value="Hide text" onclick="document.getElementById('p1').style.visibility='hidden'" />
    <input type="button" value="Show show" onclick="document.getElementById('p1').style.visibility='visible'" />

  2. #2
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    as far as i know it cannot be done with css.

    you will need to use javascript for this effect.

    ask the mods to shift your thread in that section.

    vineet

  3. #3
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you are going to need a Javascript function that tests the visibility property of the element and if it is hidden show it, if visible hide it.

    Simply function though

  4. #4
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you...


Bookmarks

Posting Permissions

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