0

Could someone have a quick glance at this code and let me know where I'm going wrong.

On the blur event, the .textok class loads fine but, the .textbad class does not.

<style>
   .textok {
color:#0F0;
background-color:#093;
};
.textbad {
color:#F00;
background-color:#900;
 };
  </style>

 <script>

$("#name").blur(function()
{
$.post("logval.php?type=name",{ name:$('#name').val() } ,function(data)
    {
      if(data=='noname') //if no username
      {
      $("#usererror").fadeTo(200,0.1,function() //start fading the messagebox
            {
              //add message and change the class of the box and start fading
              $("#usererror").html('Name Accepted      ').addClass("textbad").fadeTo(900,1);
              $("#tic").attr("src","tic.gif").fadeTo(900,1);
            });
      } else 
      {
      $("#usererror").fadeTo(200,0.1,function() //start fading the messagebox
            {
              //add message and change the class of the box and start fading
              $("#usererror").html('Name Accepted  ').addClass("textok").fadeTo(900,1);
              $("#tic").attr("src","tic.gif").fadeTo(900,1);
            });
      }
    });
})




     </script>
1
  • off-topic, but just as a matter of good practice, I would always recommend using six-digit hex codes for colour references. Commented Aug 9, 2011 at 18:11

1 Answer 1

6

You don't put semicolons after closing braces in CSS:

.textok {
    color:#0F0;
    background-color:#093;
} /* No semicolon here! */

It's those semicolons that are preventing your CSS from being understood.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.