Message from discussion
Is it possible to execute behavior function for element from outside of this behavior?
MIME-Version: 1.0
Received: by 10.100.6.16 with SMTP id 16mr423276anf.8.1243756207149; Sun, 31
May 2009 00:50:07 -0700 (PDT)
Date: Sun, 31 May 2009 00:50:07 -0700 (PDT)
In-Reply-To: <52b3cc83-e82b-424c-b423-25fdbeb47725@j32g2000yqh.googlegroups.com>
X-IP: 72.211.225.198
References: <e5f7d6a7-f56c-4d32-b9c3-588b3dc93a36@a7g2000yqk.googlegroups.com>
<52b3cc83-e82b-424c-b423-25fdbeb47725@j32g2000yqh.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10,gzip(gfe),gzip(gfe)
Message-ID: <cc0d637c-f8a9-4027-8626-331147634962@q16g2000yqg.googlegroups.com>
Subject: Re: Is it possible to execute behavior function for element from
outside of this behavior?
From: Nathan <XGamer...@gmail.com>
To: Low Pro <low-pro@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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: