You can use [id=myId] or #myId inside the selector. Check a CSS 3
selectors reference, and use the SelectORacle
(http://gallery.theopalgroup.com/selectoracle/) to debug your
selectors :)
when you do $$(...).each(function(c) { ... }) the parameter passed to
that anonymous function is the checkbox ("each" iterates over an
enumerable passing every element to a function, read it on
http://prototypejs.org/api/enumerable/each ).
If you want to check whether the checkbox is already checked you can
check the 'checked' property on the checkbox (sic) //=> if (c.checked)
{ ... }
If you want to find all checkboxes that are checked, you can use
Enumerable.select:
$$("input[type=checkbox]").select(function(c) { return c.checked })
Which will return the "filtered" array of all those items that return
true on the iterator. Again, see the API at
http://prototypejs.org/api/enumerable/select
If you need to do something different for the first item, you can use
the second (optional) argument passed to each/select/etc which is the
current index.
$$("input ....").each(function(checkbox, index) {
if (index == 0) {
// first checkbox
}
...
});
Best,
-Nicolas
On 9/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> and how can i get a list with th name and value/checked?
>
>
> > $$("input[type=checkbox][name*=part_of_the_name]").each(function(c) {
> > c.checked = false; });
>
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 17.7912 from 19.09.2007
> Virus news: www.antiviruslab.com
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---