Forum: Ruby on Rails Calling a javascript function after loading a partial with r

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ac1da5d66d51a1c3b843221032247b30?d=identicon&s=25 Eric Goodwin (Guest)
on 2006-02-03 07:12
(Received via mailing list)
Hi,
Is is possible to call a javascript function once a partial is loaded.
Here's what I am doing.
I have a partial that gets updated via. an ajax call. When the partial
is updated I want to call a javascript function ( enableTooltips ) which
will then add tooltips to my links in the newly updated partial.
Any help would be greatly appreciated.
Thanks,
Eric

--
Eric Goodwin
ericgoodwin.com
Af93ba6b6b59f22a8f37e8de5702ef98?d=identicon&s=25 Bob Silva (Guest)
on 2006-02-03 07:18
(Received via mailing list)
I believe the :complete option will accomplish this for you.

Another method is to stick a script tag in your partial that calls the
function.

Haven't used either of these, just recalling from the API docs I read so
take it as a starting point for your research.

Bob Silva
http://www.railtie.net/
Ac1da5d66d51a1c3b843221032247b30?d=identicon&s=25 Eric Goodwin (Guest)
on 2006-02-03 07:30
(Received via mailing list)
Thanks for the help Bob,

Putting the code in the partial works fine in Firefox, but alas IE lets
up down on this one. It seems that IE doesn't allow changing HTML tables
via DOM until they are fully rendered. IE crashes with an "Operation
Aborted" error. This happens in both IE 6 and the new IE 7 Beta.

The :complete worked perfectly though. I should have known. It's getting
late though and my brain isn't working like it should be.

Thanks again,
Eric


Bob Silva wrote:

>
>>Hi,
>>Eric Goodwin
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>


--
Eric Goodwin
ericgoodwin.com
This topic is locked and can not be replied to.