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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    DIV emptying in JS

    Hi,

    Trying to empty a div using javacrript. I saw trying, I have yet not got much.
    I tried setting the div to hidden, this works to some exstent but has a problem...

    When the div is full, the page expands, when I hide the div the page is still expanded with a big blank gap, I need to empty the div so the page goes back to normal size.

    Any one know how to do this using js? or have any links etc?

    Many thanks
    Sir P

  • #2
    Regular Coder
    Join Date
    Jun 2006
    Posts
    225
    Thanks
    6
    Thanked 3 Times in 3 Posts
    visibility: hidden will simply hide the content, but it will still take up space on the page. Use display: none if you do not wish the DIV to take up space.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Thanks downstrike, been looking for that for a while.

    I have a question thogh, if NONE gets ride of it.. what displays it again? I tried show, true and run-in but none worked..


    any idea?

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    I just did it, be putting 'blank' into the style

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    mydivobject.style.display='none';//hides
    mydivobject.style.display='';//shows
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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