On 30 July 2010 10:51, Yozefff <[email protected]> wrote:
> Question ..
>
> Let's say I have 100 input fields, type = text. I want to put a onblur
> on all of them and pointing to the same function.
>
> So I've used
>
> $$("input") and invoke a blur.
>
> This works .. but my question is .. will this generate 100 events? So
> will my memory get filled with 100 on blurr events?
>
> Would it be the same if I just Even.subscribe 100 times?
>
> greets
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.
>
>
I'd recommend putting the onblur on the form element and use
Event.findElement('input[type=text]')
e.g.
$('form_id').observe('blur', function(ev) {
var el = ev.findElement('input[type=text]');
if (el) {
// el is the element that triggered the blur.
}
});
sort of thing.
Regards,
Richard.
[1] http://api.prototypejs.org/dom/event/findelement/
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en.