Reputation: 211
I'm having a body. In that there is one field "status". If status=OK background should be white color. If status=error, background should get red. Please tell me how to give the condition in CSS file.
Upvotes: 2
Views: 6024
Reputation: 949
Try this Jquery Code
$( "#status" ).change(function() {
if($(this).val() == "OK")
{
$("body").css("background-color","white");
}
else
{
$("body").css("background-color","red");
}
});
Upvotes: 1
Reputation: 225
You can use jquery method to do so. Try the following:
var status = $("[id$=lblStatus]").val()
if(status == "Ok")
{
$jQuery("body").css("background-color","White");
}
else if (status == "Error")
{
$jQuery("body").css("background-color","Gray");
}
Upvotes: 1