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
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
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
Thanks a lot for helping me out! I've figured out that $
(this).attr("checked"); returns true or false.
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
5 matches
Mail list logo