Change text fields background colour if negative number using Jquery/CSS

Posted by Dan C on Stack Overflow See other posts from Stack Overflow or by Dan C
Published on 2010-03-30T09:12:36Z Indexed on 2010/03/30 9:23 UTC
Read the original article Hit count: 331

Filed under:
|
|

Hi,

I have the following text input on a budget calculator form which displays the final balance...

<tr><td align="right"><b>Balance: &pound;</b></td><td align="left"><input type="text" class="res" name="res" id="res" size="10" readonly="readonly"></td></tr>

How do I go about setting the background of the input to red using css and jquery if the value is a negative number?

I am sure this is very simple but I have scanned the net looking for a solution for ages.

Please can someone help?, my head hurts!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css