Reputation: 816
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>
Upvotes: 0
Views: 56
Reputation: 281875
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.
Upvotes: 6