Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2012
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Hide div on click

    Basically all I want is to hide a position:fixed; div box when I click it.

    I've tried a few things that I read online but none of them seem to work. Anyone know how to do this?
    Last edited by Xellic; 11-22-2012 at 02:14 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Add an attribute
    Code:
    onclick="this.display='none'"
    on it.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Nov 2012
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Add an attribute
    Code:
    onclick="this.display='none'"
    on it.
    This does not seem to work.

  • #4
    New Coder
    Join Date
    Nov 2012
    Posts
    13
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Nevermind, I figured it out. To anyone who wanted to know it's:

    Code:
    <div onclick="this.style.visibility='hidden'"></div>

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,724
    Thanks
    6
    Thanked 1,013 Times in 986 Posts
    Well, yeah. Likewise you would do this.style.display='none'. abduraooft just forgot the “style”.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Oops... :-(
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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