Have you tried passing two selectors to select()?

$('myForm').select('input[id^="act"]', 'select[id^="act"]').invoke('enable');



xzyfer wrote:
> hey guys,
>
> i have a page in which i disable a form:
>
> $('myForm').diable();
>
> Then i need to enable only form elements who id begins with 'act':
>
> $('myForm').select('*[id^="act"]').invoke('enable');
>
> the problem is that the select also returns elements such as links
> ('a') whose ids also begin with 'act'.
> as you can imagin calling enable() on a link throws an error.
>
> im not very familier with the css select syntax used in prototype, and
> i am unsure if it is possible to limit the select to only form
> elements i.e. input, select, button
>
> i tried something like this:
>
> $('myForm').select('[input|select]*[id^="act"]').invoke('enable');
>
> but i suppose thats more regex then selector syntax.
>
> is there anyway of achieving this without resorting to something like
> $('myForm').select('*[id^="act"]').each(function(e) { if(e.type ==
> 'input') { e.enable(); } );
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to