treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Problems with adding CSS to a jQuery .after() element

  • Here is the html ... I tried to apply the css inline ...

    .....
    <div class="success-message" style="postion: absolute; left: 100px; top: 500px;">

    <div class="success-message1" style="top: -7px; position: absolute; left: 52px;
    font-size: 1.1em; ">
    </div><!--end of success-message1-->

    <div class="success-message2" style="font-size: 0.8em; position: absolute; top: 56px;
    right: 10px; left: 47px; font-weight: bold;">
    </div><!--end of success-message2-->

    </div><!--end of success-message-->
    .....


    Here is the js code ...

    .....
    else
    {
    $("#contact-form").hide('slow');
    $(".success-message1") .after('Your message was successfully sent!');
    $(".success-message2") .after('You should receive a response with in one to two business days.');
    }
    .....


    Here is the CSS ...


    .success-message1:{
    top: -7px;
    position: absolute;
    left: 52px;
    font-size: 1.1em;
    }

    .success-message2:{
    font-size: 0.8em;
    position: absolute;
    top: 56px;
    right: 10px;
    left: 47px;


    None of these options worked ... Here is a link to my website ... http://lynchburgpatriots.webatu.com/Contact.html

    Any help would be appreciated!!!

    Thanks!
  • Maybe you mean:

    $(".success-message1").html('Your message was successfully sent!');
    $(".success-message2").html('You should receive a response with in one to two business days.');


    CSS Selectors doesn't require colon before bracket:

    .success-message1 {
    top: -7px;
    position: absolute;
    left: 52px;
    font-size: 1.1em;
    }

    .success-message2 {
    font-size: 0.8em;
    position: absolute;
    top: 56px;
    right: 10px;
    left: 47px;
    }
  • Thank you sooo much! Oh, yeah I know CSS selectors do not need colons before the bracket ... I had just tried using the CSS Pseudo-element :after and had forgotten to delete the colon.

    Thanks again!