Arg, stupid tabs not working.... here it comes again...
$("table td").each( function () {
var nr = parseFloat($(this).text());
if (nr >= 1.5)
$(this).addClass("positive");
else if (nr <= -1.5)
$(this).addClass("negative");
});
something similar to this should work...
//Kristinn
On 2/16/07, Kristinn Sigmundsson <[EMAIL PROTECTED]> wrote:
> First thought:
>
>
> On 2/16/07, rolfsf <[EMAIL PROTECTED]> wrote:
> >
> > Is there a clever way in jQuery to find non-zero data in specific columns of
> > a table, and assign them a class based on whether they are positive or
> > negative? In plain English, I want to make positive numbers green (or the
> > cell bg) and the negative numbers red, but only in certain columns. Ideally,
> > I would want to fine tune the range - say, > 1.5 is green and < -1.5 is red.
> > I suspect that COL and COLGROUP are not very useful as selectors.
> >
> > Thanks!
> > --
> > View this message in context:
> > http://www.nabble.com/adding-a-class-to-positive-and-negative-data-cells-in-a-table-column-tf3240521.html#a9007930
> > Sent from the JQuery mailing list archive at Nabble.com.
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
>
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/