Calling more than one effect fails (script.aculo.us) - Correction

0 views
Skip to first unread message

bill

unread,
Jul 25, 2009, 8:31:08 AM7/25/09
to Prototype & script.aculo.us
Hi,

sorry for this second post. I just observed something new. The problem
is, if I call two effect functions and there is no div for the first,
the second won't be executed. If both exist, both will be executed.
Can I somehow check if a related div exists or start both function no
matter if divs exists?

Thank you,
bill

mr_justin

unread,
Jul 27, 2009, 12:24:49 PM7/27/09
to Prototype & script.aculo.us
Do not call the Effect method with a non-existent element ID.

if ($('foo')) new Effect.Highlight('foo'); // or: $('foo').highlight();

Walter Lee Davis

unread,
Jul 27, 2009, 1:48:18 PM7/27/09
to prototype-s...@googlegroups.com
Another way that neatly avoids the problem:

$$('#foo').invoke('highlight');

Walter

bill

unread,
Jul 28, 2009, 6:21:30 AM7/28/09
to Prototype & script.aculo.us
This solves my problem perfectly. Thank you
Reply all
Reply to author
Forward
0 new messages