[jQuery] Re: Getting a checkbox value

2007-05-16 Thread Erik Beeson
Way to just rain all over my jQuery parade man :). jQuery has made me a lousy javascript coder. It really feels like a new language with javascript syntax, not just a javascript library (Prototype, for example, just feels like a library). Sometimes I forget you don't always need a $ in front of e

[jQuery] Re: Getting a checkbox value

2007-05-16 Thread RobG
On May 16, 6:45 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > I prefer to use the is() function for this type of thing because I > think it reads really well: > > if($(this).is(':checked')) { Somewhat more convoluted than: if (this.checked) {...} -- Rob

[jQuery] Re: Getting a checkbox value

2007-05-16 Thread Erik Beeson
I prefer to use the is() function for this type of thing because I think it reads really well: if($(this).is(':checked')) { ... } else { ... } It reads "if this is checked...", which I like. --Erik On 5/16/07, Skilip <[EMAIL PROTECTED]> wrote: Thanks a lot for helping me out! I've figure

[jQuery] Re: Getting a checkbox value

2007-05-16 Thread Skilip
Thanks a lot for helping me out! I've figured out that $ (this).attr("checked"); returns true or false.

[jQuery] Re: Getting a checkbox value

2007-05-15 Thread Josh Nathanson
You have to do something like this: $(this).attr("checked") ? $(this).val() : 0 This will return the value if it's checked, or 0 if it's not. $(this).val() is just reaching into the dom and getting the attribute "value" of the element, whether or not it's checked. -- Josh - Original Me