RE: [jQuery] Re: AND OR Expression
> "Expecting it to?" Demeaning attitude...real helpful...just make people feel stupid when they request help. Great community building skills, Z... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Thursday, December 10, 2009 2:46 PM To: jQuery (English) Subject: [jQuery] Re: AND OR Expression > 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" 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" 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 > > 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 -
Re: [jQuery] Re: AND OR Expression
var tdval = parseInt(td4th.text(), 10); //base 10 if ( (tdval > 4) || (tdval > 2 && activeCEO == 'Yes') ) - Richard On Thu, Dec 10, 2009 at 3:26 PM, evanbu...@gmail.com wrote: > If I knew what I was doing, why would I be asking for help? I already > know what doesn't work. That's why I posted the question. > > Is this right? > > if parseInt((td4th.text() > 4)) || (parseInt((td4th.text())) > 2 && > (activeCEO == 'Yes')) > > On Dec 10, 2:46 pm, MorningZ wrote: > > > 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" 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" 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 > > > > 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 -- Hide quoted text - > > > > - Show quoted text - >
RE: [jQuery] Re: AND OR Expression
I'm able to help, too, but by the time I read messages there are usually responses... Anyway, you don't have to care what *I* think, but you should care what those you are trying to help think. Attitude is as important as knowledge... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Thursday, December 10, 2009 7:20 PM To: jQuery (English) Subject: [jQuery] Re: AND OR Expression On Dec 10, 2:59 pm, "Rick Faircloth" wrote: > Demeaning attitude...real helpful...just make people feel stupid when > they request help. Great community building skills, Z... Not my attempt not like a give a care what you think of me anyways i'm at least able to help on this forum
RE: [jQuery] Re: AND OR Expression
I know...helping can be a pain...but try to be patient and remember back when you didn't understand how jQuery worked. It takes some getting used to the principles and techniques and it's easy to forget what it's like to be a beginner. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Thursday, December 10, 2009 7:23 PM To: jQuery (English) Subject: [jQuery] Re: AND OR Expression On Dec 10, 2:59 pm, "Rick Faircloth" wrote: > Demeaning attitude...real helpful...just make people feel stupid when > they request help. Great community building skills, Z... Not my intent he wasn't comparing apples to apples, and didn't get this... *twice* not like a give a care what you think of me anyways