Dave wrote:
Hi. I need help on what is essentially putting an "onload" event handler into a div. I am using render :partial and when the partial is loaded, I would like the divs to show using an effect from a library such as scriptaculous or moofx. However, there is no "onload" for a div. I was wondering what alternative methods I should use to achieve this.
Thanks!
If you put the j-script you want to execute in a <script></script> block that appears immediately after the div, and have the script execute immediately, then it will only run immediately after the div is in place.
E.g.:
<div> content content content </div>
<script type="text/javascript"> function do_something_to_div() { ... }
do_something_to_div(); </script>