thanks for samples

On 17 дек, 17:40, "T.J. Crowder" <[email protected]> wrote:
> Hi,
>
> Just reuse the same handler for multiple events:
>
>     function handler(event) { /* ... */ }
>
>     element
>         .observe('change', handler)
>         .observe('paste', handler);
>
> If you need to bind, do that first so you're not creating unnecessary
> extra functions:
>
>     var Thingy = Class.create((function() {
>
>         function handler(event) { /* ... */ }
>
>         function hookUsUp(element) {
>             var boundHandler = handler.bind(this);
>             element
>                 .observe('change', boundHandler)
>                 .observe('paste', boundHandler);
>         }
>
>         return {hookUsUp: hookUsUp};
>     })());
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Dec 17, 2:03 pm, buda <[email protected]> wrote:
>
>
>
> > What is the best way to attach one observer to many events
> > for examle: I need to attach an observer to input element to validate
> > input value for 'change' and 'paste' events- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -

--

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.


Reply via email to