On Nov 10, 2008, at 12:06 AM, Steffan A. Cline wrote:


on 11/9/08 5:31 PM, Karl Swedberg at [EMAIL PROTECTED] wrote:

Hi Steffan,

I think you're missing the colon in front of checkbox. Should be:

$(":checkbox:checked").length

or

$("input:checkbox:checked").length

On Nov 9, 2008, at 7:07 PM, Steffan A. Cline wrote:


Does anyone have a quick trick for getting a count of all checked
checkboxes? I tried $("checkbox:checked").length and I always get 0. Is
there a trick for this?

What is the difference between what you posted and

$("[EMAIL PROTECTED]@checked]").size()


Hi Steffan,

No difference in what will be returned. Mine is shorter, saves some bytes.

- [EMAIL PROTECTED] is the same thing as :checkbox, except the "@" part is deprecated, so you could write it as input[type=checkbox]

- [EMAIL PROTECTED] is the same thing as :checked, but, again, the "@" part is deprecated.

- .size() is functionally the same thing as .length

Hope that helps,

--Karl

Reply via email to