Hi Kean,
Actually, :checked works on radio buttons, too, so if Andy needed to
distinguish between checkboxes and radios, he'd need to do $
(':checkbox:checked') as he mentioned in his original post.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Dec 31, 2008, at 11:42 AM, Kean wrote:
Correct me if I am wrong but I believe :checked works on checkboxes
only, hence
$(":checked") is sufficient.
On Dec 31, 7:59 am, Karl Swedberg <k...@englishrules.com> wrote:
not sure, but this works, too:
$(":checkbox[checked]")
--Karl
____________
Karl Swedbergwww.englishrules.comwww.learningjquery.com
On Dec 31, 2008, at 6:29 AM, Andy Fish wrote:
Hi,
I was trying to select for checked checkboxes so I tried
$(":checkbox[checked=true]")
this never returns anything, even though if I select all
checkboxes I
can test "this.checked" for each one and it returns true/false as
appropriate.
I now understand that I can to :checkbox:checked, but I don't
understand why my original approach doesn't work, since clearly each
checkbox has an attribute 'checked' which has the value true or
false.
Andy