Mike Schinkel schrieb:
Hi all:

Is there a one-liner to collect id attributes for checked input fields?
This only gives me the first one:

        $('input:checked').id()

I can't see to figure this out. Best I can do is write 6 or 7 lines of
hackish code to get them and it feels like there should be a better 'jQuery'
way.

Thanks in advance.
Give this a try:
$(":checked").map(function() { return this.id });

map() is great for stuff like that: http://docs.jquery.com/Traversing/map#callback

Sidenote: In ES4 you could write: $(":checked").map(function() this.id);

Jörn

Reply via email to