That was too easy. Thank you for the quick response!
$(document).ready(function()
{
$("a[id*='activate-']").each(function(i){
$(this).click(function(){
$('#toggle1-'+i).slideToggle('slow');
$('#toggle2-'+i).slideToggle('slow');
});
});
});
On Dec 10, 1:59 pm, "Brian Cherne" <[EMAIL PROTECTED]> wrote:
> If I understand your question properly, it is possible. Try something like
> this:
>
> $(document).ready(function()
> {
> $("a").each(function(i){
> $(this).click(function(){
> alert(i);
>
> });
> });
> });
>
> Brian.
>
> On Wed, Dec 10, 2008 at 10:29 AM, Brett Alton <[EMAIL PROTECTED]>wrote:
>
>
>
> > Sorry, I'm new to Google Groups and was trying to reply to a post but
> > couldn't figure out how without e-mailing the author directly[1].
>
> > I'm trying to add the click() event to the each() loop constructor.
>
> > e.g.
> > $(document).ready(function()
> > {
> > $("a[id*='activate-']").each(function(i){
> > $('#toggle1-'+i).slideToggle('slow');
> > $('#toggle2-'+i).slideToggle('slow');
> > });
> > });
>
> > This works, and toggles all corresponding ids called '#toggle1-'+i and
> > #toggle2-'+i, but I only want it to activate when the anchor is
> > clicked. Is this possible?
>
> > [1]
> >http://groups.google.com/group/jquery-en/browse_thread/thread/b6d1dea...