Jquery, JSON auto update DIV class real-time

I have a site which displays real-time data that updates every 3 seconds. What I'd like to do is if a JSON value goes below a certain number, that I display a DIV at the top of the screen with a specific class included on it (turning background a specific color and font different color). THen when the number gets higher than the set value, the DIV would be hidden, the page would jump back up into position and it would be like the DIV was never there.

In my css I had made 2 classes.. one with BG color, and display:block, and the other with an all white BG color, and display:hidden.  

I then tried to use the .addClass feature but it doesn't appear to be updating.

Can someone write up a quick example that I can follow?
MrBaseball9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StealthyDevCommented:
This would help you!

.className

Regards.
<style>
.class1
{
	color:red;
}
.class2
{
	color:green;
}
</style>

<div id="mydiv" class="class1">test</div>
<input type="button" value="switch" onclick = "document.getElementById('mydiv').className = 'class2';">

Open in new window

0
MrBaseball9Author Commented:
I just got it to work. I think I was writing the remove class part wrong.
if(queue < 1)
{
$('#theQueue').removeClass();
$('#theQueue').addClass("inQueue");
}
else
{
$('#theQueue').remoteClass();
$('#theQueue').addcCass("outQueue")
}
....
then I had my setTimeout set to 3 secs
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
StealthyDevCommented:
Thats cool...
0
Albert Van HalenAnalyst developerCommented:
NB display:hidden is not correct.
Use display:none
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.