[jQuery] Re: Why is console.log(valid) returning "yes" in this code?

2009-09-02 Thread Rick Faircloth
.or rather, code and learn... Thanks, James and MZ... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of James Sent: Wednesday, September 02, 2009 10:45 PM To: jQuery (English) Subject: [jQuery] Re: Why is console.log(valid) returning &qu

[jQuery] Re: Why is console.log(valid) returning "yes" in this code?

2009-09-02 Thread MorningZ
> I think you mean: > by using that, you are -NOT- stomping over the "outside" one. Indeed... a classic case of thinking faster than i was typing

[jQuery] Re: Why is console.log(valid) returning "yes" in this code?

2009-09-02 Thread Rick Faircloth
Behalf Of MorningZ Sent: Wednesday, September 02, 2009 10:36 PM To: jQuery (English) Subject: [jQuery] Re: Why is console.log(valid) returning "yes" in this code? "Why?" Because you are failing to understand "variable scope" Don't use the "var" keyw

[jQuery] Re: Why is console.log(valid) returning "yes" in this code?

2009-09-02 Thread James
I think you mean: by using that, you are -NOT- stomping over the "outside" one. Rick, If you don't understand, using "var" is a variable declaration. Setting: var valid = 'no'; inside the each() callback function will have that variable exist locally only inside that function. It will not overwr

[jQuery] Re: Why is console.log(valid) returning "yes" in this code?

2009-09-02 Thread MorningZ
"Why?" Because you are failing to understand "variable scope" Don't use the "var" keyword inside the if block, by using that, you are stomping over the "outside" one http://www.google.com/search?q=Javascript+variable+scope On Sep 2, 10:26 pm, "Rick Faircloth" wrote: > Here's the code: > > va