Go to Google Groups Home    Low Pro
Re: Is it possible to execute behavior function for element from outside of this behavior?

Nathan <xgamer...@gmail.com>

I agree with Morgan's take which is to use Event.delegate within a
container element to easily have access to both the span and the form
from a single behavior.

Otherwise, you can indeed execute a behavior outside the behavior. i.e

var example = new Link.Toggle($('some-element'));

then

example.onclick(event);

or you can access the instances of a behavior and find the right one
that way:

Link.Toggle.instances().first().onclick(event);