> This isn't working out for me " Expecting it to?
First post you were comparing: string > string... which isn't going to work Follow up post after blowing right over Richard's suggestion, you are comparing string > number, which *still* isn't going to work... and this line doesn't make any sense var td4th = parseInt($('td:nth-child(4)', jQuery (this))); as you are parseInt-ing a jQuery object.... On Dec 10, 2:36 pm, "evanbu...@gmail.com" <evanbu...@gmail.com> wrote: > This isn't working out for me > > var td4th = parseInt($('td:nth-child(4)', jQuery > (this))); > if (td4th.text() > 4) || ((td4th.text() > 2 && (activeCEO == > 'Yes')) > td4th.addClass(bgColor); > > If I do this, it works > > if (td4th.text() > 4) > td4th.addClass(bgColor); > > but once I add the rest beyond the || operator it doesn't. > > On Dec 10, 1:29 pm, "Richard D. Worth" <rdwo...@gmail.com> wrote: > > > Convert with parseInt and then compare int to int instead of strings > > >https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global... > > > - Richard > > > On Thu, Dec 10, 2009 at 12:26 PM, evanbu...@gmail.com > > <evanbu...@gmail.com>wrote: > > > > I having trouble with this line > > > > if (td4th.text() > '4') || (td4th.text() > '2' && (activeCEO == > > > 'Yes')) > > > > In plain English, I want it to be true if > > > > td4th > 4 > > > > OR > > > > td4th > 2 AND activeCEo = 'Yes' > > > > Thanks > > > > $('#tblBoardDirectors tr').each(function() { > > > var relStatus = ($('td:nth-child(5)', $(this)).text()) > > > var activeCEO = ($('td:nth-child(12)', $(this)).text > > > ()); > > > { > > > if (relStatus != 'Retired') { > > > var td4th = $('td:nth-child(4)', $ > > > (this)); > > > if (td4th.text() > '4') || (td4th.text() > > > > '2' && (activeCEO == 'Yes')) > > > td3rd.addClass(bgColor); > > > } > > > } > > > });- Hide quoted text - > > > - Show quoted text -