Hi Sander,

On Fri, Oct 24, 2008 at 16:17, SanderElias <[EMAIL PROTECTED]> wrote:
> Now I found myself dong this:
>
>        var o = document.getElementsByTagName('input');
>        every(o,function(e){addValidFunc(e);return true})
>
> this functions as expected, but I figured there must be a more elegant
> way off doing this. I'm feeling very dense that I could not figure it
> out by myself. I guess I need to fight my mental block ;)

Since you are explicitly returning "true" for each element, there's no
need to use "every". You can use forEach instead:

var o = document.getElementsByTagName('input');
forEach(o, addValidFunc);

If you care for using the Selector library you can replace the first line with

var o = $$('input');

cheers,
Arnar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to