SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide Contact Form Error Div Until Needed

    I have a contact form that displays the error in a div with the class .error.. it has "margin-bottom:2em;" which pushes the contact form down since its above the contact form. How do I activate the "margin-bottom:2em" only when the error div is displaying errors?

  2. #2
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    You would need to add the margin to it's own class and then when the error is triggered (assuming you're doing this with javascript) you could change the class of the div to the one with the margin. When the error has been corrected you could trigger the class to switch back without the margin.

    http://programming.top54u.com/post/J...f-Div-tag.aspx
    TAKE A WALK OUTSIDE YOUR MIND.

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,619
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    How are you hiding the error div before it's shown? It should be as easy as div.error display none. The script (depending) should handle the rest. Here is some code to look at... http://www.visibilityinherit.com/cod...ation-demo.php

  4. #4
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i got it to work thx u 2


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
  •